Last active
August 31, 2019 06:57
-
-
Save tsuzukihashi/326cb3e3f67b6645dade24a14a52dc49 to your computer and use it in GitHub Desktop.
Unity 全シーン管理マネージャーの作成 ref: https://qiita.com/tsuzukihashi/items/1d8a9fce4465c688c78a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class DDManager : MonoBehaviour { | |
public GameObject gameObject; | |
void Start () { | |
DontDestroyOnLoad(gameObject); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
public class ManagerSceneAutoLoader : MonoBehaviour { | |
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] | |
private static void LoadManagerScene(){ | |
string managerSceneName = "ManagerScene"; | |
//ManagerSceneが有効でないときに追加ロード | |
if(!SceneManager.GetSceneByName(managerSceneName).IsValid()){ | |
SceneManager.LoadScene(managerSceneName, LoadSceneMode.Additive); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment