diff --git a/Assets/Scripts/Utility/DontDestroyOnLoad.cs b/Assets/Scripts/Utility/DontDestroyOnLoad.cs new file mode 100644 index 0000000..2000035 --- /dev/null +++ b/Assets/Scripts/Utility/DontDestroyOnLoad.cs @@ -0,0 +1,68 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using NaughtyAttributes; + + +/// +/// +/// +public class DontDestroyOnLoad : MonoBehaviour +{ + + #region Inspector Fields + + #endregion Inspector Fields + + #region Private Fields + + #endregion Private Fields + + #region Getters + + #endregion Getters + + + + #region MonoBehaviour Functions + /// + /// OnEnable is called when the object becomes enabled and active. + /// + private void OnEnable() + { + DontDestroyOnLoad(transform.root.gameObject); + } + + /// + /// OnDisable is called when the behaviour becomes disabled. + /// + private void OnDisable() + { + + } + + /// + /// Update is called once per frame + /// + private void Update() + { + + } + + #endregion MonoBehaviour Functions + + #region Class Functionality + + #endregion Class Functionality + + #region Editor Functions + /// + /// Called when the Component is created or Reset from the Inspector + /// + private void Reset() + { + //useful for finding components on creation + } + #endregion Editor Functions + +} \ No newline at end of file diff --git a/Assets/Scripts/Utility/DontDestroyOnLoad.cs.meta b/Assets/Scripts/Utility/DontDestroyOnLoad.cs.meta new file mode 100644 index 0000000..67a26ea --- /dev/null +++ b/Assets/Scripts/Utility/DontDestroyOnLoad.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b48b19a36ebb65f46aca5366979419a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: