private void Awake() { if (_instance == null) { _instance = this; } if (_playerCtrl == null) { _playerCtrl = GetComponent <PlayerCtrl>(); } }
void AvoidNULLProblem() { if (_PlayerStatementSystem == null) { _PlayerStatementSystem = GetComponentInParent <PlayerStatementSystem>(); } if (_PlayerAudioManager == null) { _PlayerAudioManager = GetComponentInParent <PlayerAudioManager>(); } if (_PlayerCtrl == null) { _PlayerCtrl = GetComponentInParent <PlayerCtrl>(); } }
//Function : AvoidNullProblem // Method : This Function is Mainly used For GetThe Component which is NULL void AvoidNullProblem() { if (_instance == null) { _instance = this; } if (_pi == null) { _pi = GetComponent <PlayerInput>(); } if (_PlayerAudioManager == null) { _PlayerAudioManager = GetComponent <PlayerAudioManager>(); } if (_anim == null) { _anim = GetComponentInChildren <Animator>(); } if (_rgbd == null) { _rgbd = GetComponent <Rigidbody>(); } if (_PlayerStatementSys == null) { _PlayerStatementSys = GetComponent <PlayerStatementSystem>(); } if (_cap == null) { _cap = GetComponent <CapsuleCollider>(); } if (HitTrigger == null) { Debug.Log("Please Add The Object To The Inspector"); } }