See the code here
Tutorial video (click the image):
Create data asset: Create > Level > levelFlow
Double click to open the editor windo.
*note: Keep MainScene
null if you don't have a scene that needs to be consistantly exist.
-
Save / Load
Save/Load the data.
-
Update current scene
If there is a corespond node of current scene on the graph view, it'll sample the gameobjects of type
ConnectPoint
, and project them onto level node.If node is not showing, please press
save
andload
again. -
Load all scene
Load all scenes on the graph view onto game scene.
-
Close scenes
Unload other previesing scenes.
-
Start Node
-
name
A string to specified a enterence point.
To choise a start point, call:
LevelFlowManager.LoadFromStart("StartPoint");
-
-
Level Node
-
[ Async | Sync ]
Load scene type in async or sync way.
Async: Load in background.
Sync: The game will wait for the scene to finish loading.
-
[ Single | Additive ]
How the scene is going to add to current game.
Single: Close other scene, load this scene and keep the main scene if
MainScene
is set.Additive: Add this scene to current game.
-
You don't need to instance the manager.
public class LoadFirstSceneControl : MonoBehaviour
{
public LevelMapSO data;
private void Start()
{
//NOTE: You can do a check-point loading to
//load to the certain scene.
LevelFlowManager.flowData = data;
LevelFlowManager.LoadFromStart("StartPoint");
}
}
public class MyPoint : ConnectPoint
{
public void LoadNext(){
LevelFlowManager.LoadNextScene(portSetId);
}
}
-
LevelFlowManager.cs
-
public static event Action<string> OnConnectPointEntered;
Called when finish loading scene. Return the
portSetGuid
of the matching enternce point gameObject.in demo:
RangeTriggerConnectPoint.cs
.public void OnEnable() { LevelFlowManager.OnConnectPointEntered += MovePlayerHere; } public void OnDisable() { LevelFlowManager.OnConnectPointEntered -= MovePlayerHere; } private void MovePlayerHere(string _enterPoint) { if (_enterPoint == portSetId) { GameObject.FindGameObjectWithTag("Player").transform.position = transform.position; leaveLock = true; } }
-