Browse Source

DontDestroyOnLoad

main
Joshua Reason 1 year ago
parent
commit
be2402e05f
2 changed files with 79 additions and 0 deletions
  1. +68
    -0
      Assets/Scripts/Utility/DontDestroyOnLoad.cs
  2. +11
    -0
      Assets/Scripts/Utility/DontDestroyOnLoad.cs.meta

+ 68
- 0
Assets/Scripts/Utility/DontDestroyOnLoad.cs View File

@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyAttributes;
/// <summary>
///
/// </summary>
public class DontDestroyOnLoad : MonoBehaviour
{
#region Inspector Fields
#endregion Inspector Fields
#region Private Fields
#endregion Private Fields
#region Getters
#endregion Getters
#region MonoBehaviour Functions
/// <summary>
/// OnEnable is called when the object becomes enabled and active.
/// </summary>
private void OnEnable()
{
DontDestroyOnLoad(transform.root.gameObject);
}
/// <summary>
/// OnDisable is called when the behaviour becomes disabled.
/// </summary>
private void OnDisable()
{
}
/// <summary>
/// Update is called once per frame
/// </summary>
private void Update()
{
}
#endregion MonoBehaviour Functions
#region Class Functionality
#endregion Class Functionality
#region Editor Functions
/// <summary>
/// Called when the Component is created or Reset from the Inspector
/// </summary>
private void Reset()
{
//useful for finding components on creation
}
#endregion Editor Functions
}

+ 11
- 0
Assets/Scripts/Utility/DontDestroyOnLoad.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b48b19a36ebb65f46aca5366979419a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save