Skip to content

Instantly share code, notes, and snippets.

@dyguests
Last active December 18, 2023 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyguests/ce84536e23ffe405d89e8232bfaea0f8 to your computer and use it in GitHub Desktop.
Save dyguests/ce84536e23ffe405d89e8232bfaea0f8 to your computer and use it in GitHub Desktop.
App, DontDestroyOnLoad, Keep in Scene changed.
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