void Awake() { if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref { DontDestroyOnLoad(gameObject); StaticRef = this; } else if (StaticRef != this) // is the allready is a ref , destory this { Destroy(this); } //get refeances controller = GetComponent<CharacterController>(); anim = GetComponentInChildren<Animator>(); CurrentState = State.canMove; }
void Awake() { if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref { DontDestroyOnLoad(gameObject); StaticRef = this; } else if (StaticRef != this) // is the allready is a ref , destory this { Destroy(this); } //get refeances controller = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); CurrentState = State.canMove; }