NullReferenceException: Object reference not set to an instance of an object
PlayerController.OnDisable () (at Assets/Scripts/Player/PlayerController.cs:40)
UnityEngine.Object:Destroy(Object)
Singleton`1:Awake() (at Assets/Scripts/SceneManager/Singleton.cs:14)
PlayerController:Awake() (at Assets/Scripts/Player/PlayerController.cs:25)
protected override void Awake()
{
base.Awake();
playerControls = new PlayerControls();
rb = GetComponent<Rigidbody2D>();
myAnimator = GetComponent<Animator>();
mySpriteRenderer = GetComponent<SpriteRenderer>();
knockBack = GetComponent<KnockBack>();
}
private void OnEnable()
{
playerControls.Enable();
}
private void OnDisable()
{
playerControls.Disable();
}
protected virtual void Awake()
{
if (instance != null && this.gameObject != null)
{
Destroy(this.gameObject);
}
else
{
instance = (T)this;
}
if (!gameObject.transform.parent)
{
DontDestroyOnLoad(gameObject);
}
}