Class KeepAliveBehaviour<T>
Base class for ACTk in-scene objects which able to survive scene switch.
public abstract class KeepAliveBehaviour<T> : MonoBehaviour where T : KeepAliveBehaviour<T>
Type Parameters
T
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourKeepAliveBehaviour<T>
- Derived
Remarks
⚠️ Warning: Will behave incorrectly if created within any non-default [RuntimeInitializeOnLoadMethod] except RuntimeInitializeLoadType.AfterSceneLoad (which is default).
Fields
keepAlive
Will survive new level (scene) load if checked. Otherwise it will be destroyed.
[Tooltip("Detector will survive new level (scene) load if checked.")]
public bool keepAlive
Field Value
- bool
Remarks
On dispose Behaviour follows 2 rules:
- if Game Object's name is "Anti-Cheat Toolkit": it will be automatically
destroyed if no other Behaviours left attached regardless of any other components or children;
- if Game Object's name is NOT "Anti-Cheat Toolkit": it will be automatically destroyed only if it has neither other components nor children attached;
Properties
Instance
Allows reaching public properties from code. Can be null if behaviour does not exist in scene or if accessed at or before Awake phase.
public static T Instance { get; }
Property Value
- T