hi, i need help with fixing this, i dont know whats going on, about 1 or 2 months i was using the same script and having animators running well, but now i turned the (UseAnimator) variable “on” in inspector, and tested it, it gave me tons of null errors! i swear i attached the animator through Update and the parameters exists in the animator, just when the parameter has to work, like sitting on ground, it gives null errors, the script line of Animator:
private function AnimatorManager ()
{
if(UseAnimator)
{
if(UsePower)
{
Anim.SetFloat("Power",Power);
}
Anim.SetFloat("Vertical",Input.GetAxis("Vertical") && GroundChecks.Grounded && Controllable);
Anim.SetFloat("Horizontal",Input.GetAxis("Horizontal") && GroundChecks.Grounded && Controllable);
Anim.SetBool("Run",Input.GetButton("Run") && GroundChecks.Grounded && Controllable);
Anim.SetBool("Jump",Input.GetButton("Jump") && GroundChecks.Grounded && Controllable);
Anim.SetBool("Crouch",Crouch && GroundChecks.Grounded && Controllable);
Anim.SetBool("Inside Water",InsideWater && Controllable);
Anim.SetBool("Grounded",GroundChecks.Grounded && Controllable);
Anim.SetBool("Near Fall Grounded",GroundChecks.NearFallGrounded && Controllable);
Anim.SetBool("Mid Fall Grounded",GroundChecks.MidFallGrounded && Controllable);
Anim.SetBool("Far Fall Grounded",GroundChecks.FarFallGrounded && Controllable);
}
}
Also the AnimatorManager function called in function update! but i dont know whats wrong with these lines of code! The Error Message:(its one error that i pasted it here, actually they’re about 9 errors)
NullReferenceException: Object reference not set to an instance of an object
PlayerController.AnimatorManager () (at Assets/Player Controller/Scripts/PlayerController.js:165)
PlayerController.Update () (at Assets/Player Controller/Scripts/PlayerController.js:75)
is there a way to fix it? i appreciate any answers!