I’m working on a FPS. I’m new in Unity so I don’t know much about scripting. I want to make a script that makes the player able to enter aiming mode. This is the script:
@script RequireComponent(Animator)
function Update () {
if (Input.GetButtonDown ("Fire2")) {
if (!Animator.GetBool("aimingMode")) {
Animator.SetBool("aimingMode", true);
aimingMode = true;
}
}
}
I know it’s unfinished. The problem is that when I take a look at the console in unity, it says:
An instance of type ‘UnityEngine.Animator’ is required to access non static member ‘GetBool’.
I don’t know how to solve this. The gameobject has already got an animator with an animation controller and the booleans set. Please help.