Skip to content

hiyorin/Gamebase-SceneManagement

Repository files navigation

Gamebase-SceneManagement





Table Of Contents





Description

Gamebase-SceneManagement is manage scene and make scene lifecycle. Gamebase-SceneManagement is an extension for Gamebase-Core and won't work without it.





Install

Find Packages/manifest.json in your project and edit it to look like this:

{
  "scopedRegistries": [
  {
    "name": "OpenUPM",
    "url": "https://package.openupm.com",
    "scopes": [
      "com.neuecc",
      "com.cysharp",
      "com.svermeulen",
      "com.coffee",
      "com.demigiant",
      ...
    ]
  }],
  "dependencies": {
    "com.coffee.git-dependency-resolver": "1.1.3",
    "com.coffee.upm-git-extension": "1.1.0-preview.12",
    "com.gamebase.scene": "https://github.com/hiyorin/Gamebase-SceneManagement.git",
    ...
  }
}

To update the package, change #{version} to the target version.
Or, use UpmGitExtension to install or update the package.





Usage

Create Application Scene

This scene is parent scene. Manage child scenes.

  • Right Click in folder within the Project tag and Choose Create/Gamebase-Scene/Application.

Add Scene

This scene is child scene.

  • Right Click in folder within the Project tag and Choose Create/Gamebase-Scene/Scene.

Controller

  • Injection ISceneController
    [Inject] private ISceneController sceneController = default;
  • Change Scene
    sceneController.Change("scene name", "trand data");

Lifecycle

  • ISceneLifecycle implementation
    public sealed class SceneLifecycleImpl : MonoBeheviour, ISceneLifecycle
    {
      async UniTask ISceneLifecycle.OnInitialize(object transData)
      {
        // Called only once when the scene is loaded.
        // Received trans data.
        // Load dynamic resources here.
      }
    
      void ISceneLifecycle.OnDispose()
      {
        // Called only onece when the scene is unloaded.
        // Unload dynamic resources here.
      }
    }
  • Binding ISceneLifecycle instance
    public sealed class TestInstaller : MonoInstaller
    {
      [SerializeField] private SceneLifecycleImple scene = default;
      
      public override void InstallBindings()
      {
        Container.Bind<ISceneLifecycle>().FromInstance(scene).AsSingle();
      }
    }





NodeCanvas Integration

NodeCanvas is the Complete Visual Behaviour Authoring solution for Unity. For more details see the NodeCanvas docs.

Gamebase integration with NodeCanvas is disabled by default. To enable, you must add the define GAMEBASE_ADD_NODECANVAS to your project, which you can do by selecting Edit -> Project Settings -> Player and then adding GAMEBASE_ADD_NODECANVAS in the Scripting Define Symbols section.





License

This library is under the MIT License.
here