NullReference on animator scripting: CharacterController: need help.

Not sure why is throwing this code… Float is equivalent to that in animator controller.

using UnityEngine;
using System.Collections;
using System;



[RequireComponent(typeof(Animator))]
[RequireComponent(typeof(CharacterController))]

public class PlayerMovement : MonoBehaviour
{
 
    Animator animator;
    CharacterController characterController;

    [System.Serializable]
    public class AnimationSettings
    {
        public string ForwardFloat = "Speed";
        public string SideFloat = "Direction";
        public string JumpBool = "IsJumping";
        public string GroundedBool = "IsGrounded";
    }

    [SerializeField]
    public AnimationSettings animations;

    [System.Serializable]
    public class PhysicsSettings
    {
        public float gravityModifier = 9f;
        public float baseGravity = 50f;
        public float resetGravityValue = 5f;
    }

    [SerializeField]
    public PhysicsSettings physics;

    [System.Serializable]
    public class MovementSettings
    {
        public float jumpSpeed = 5f;
        public float jumpTime = 0.25f;
    }

    [SerializeField]
    public MovementSettings movement;

    bool jumping;
    bool resetGravity;
    float gravity;

    void start()
    {
        animator = GetComponent<Animator> ();
        characterController = GetComponent<CharacterController> ();
        SetupAnimator ();
    }


    void Update()
    {
        Animate (Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"));
        ApplyGravity ();
    }

    public void Animate( float Vertical, float Horizontal )
    {
        animator.SetFloat (animations.ForwardFloat, Vertical);
        animator.SetFloat (animations.SideFloat, Horizontal);
        animator.SetBool (animations.GroundedBool, characterController.isGrounded);
        animator.SetBool (animations.JumpBool, jumping);

    }

    void ApplyGravity()
    {
        if (!characterController.isGrounded)
        {
            if (!resetGravity)
            {
                gravity = physics.resetGravityValue;
                resetGravity = true;
            }

            gravity += Time.deltaTime * physics.gravityModifier;
        }

        else gravity = physics.baseGravity;
        resetGravity = false;

        Vector3 gravityVector = new Vector3 ();

        if (!jumping)
        {
            gravityVector.y -= gravity;
        }

        else
        {
            gravityVector.y = movement.jumpSpeed;
        }

        characterController.Move (gravityVector * Time.deltaTime);
    }

    void Jump()
    {
        if (jumping)
            return;

        if (characterController.isGrounded)
        {
            jumping = true;
            StartCoroutine (StopJump ());
        }
    }

    IEnumerator StopJump()
    {
        yield return new WaitForSeconds (movement.jumpTime);
        jumping = false;
    }
     

    //Set animator with the child avatar
    void SetupAnimator()
    {
        Animator[] animators = GetComponentsInChildren<Animator> ();

        if (animators.Length > 0)
        {
            for (int i = 0; i < animators.Length; i++)
            {
                Animator anim = animators [i];
                Avatar av = anim.avatar;

                if (anim != animator)
                {
                    animator.avatar = av;
                    Destroy (anim);
                }
            }
        }
    }
}

if you find yourself posting about an error in your code and you haven’t pasted in the complete error message you’re doing it wrong…

the error message has useful things like line numbers in it so we have a hope of finding it and helping you.

Help us help you…

Gotcha…Let me get and update…

Updated: Image was attached it just threw it into script coding, musta had curser inside it >.<