Last active
December 18, 2023 16:10
-
-
Save dyguests/ce84536e23ffe405d89e8232bfaea0f8 to your computer and use it in GitHub Desktop.
App, DontDestroyOnLoad, Keep in Scene changed.
This file contains 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 App : MonoBehaviour | |
{ | |
private static App sInstance; | |
public static App Instance => sInstance; | |
void Awake() | |
{ | |
#region Singleton | |
if (sInstance != null) | |
{ | |
Destroy(gameObject); | |
return; | |
} | |
sInstance = this; | |
DontDestroyOnLoad(gameObject); | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment