// Function :InstanceisNullOrNot // Method : Mainly use For Defend Duplicate Problem void InstanceisNullOrNot() { if (_INSTANCE == null) { DontDestroyOnLoad(gameObject); _INSTANCE = this; } else if (_INSTANCE != this) { Destroy(gameObject); } }
// Function : GetComponent Function // Method : mainly Use For GetComponentFunction void GetComponentFunction() { if (_rgbd == null) { _rgbd = GetComponent <Rigidbody>(); } if (_anim == null) { _anim = GetComponentInChildren <Animator>(); } if (_globalPlayerStatement == null) { _globalPlayerStatement = GetComponent <GlobalPlayerStatement>(); } }