- Home /
(23,34): BCE0019: 'SetButton' is not a member of 'UnityEngine.Animator'.
hello i have this problem in this script
pragma strict
private var animator: Animator;
var h: float; // Obrót
var v: float; // Przód/tył
var hSpeed: int;
function Start () {
animator = GetComponent(Animator);
}
function Update () {
h = Input.GetAxis('Horizontal');
v = Input.GetAxis('Vertical');
if(Input.GetButton('Jump'))
animator.SetBool('Jump',true);
else
animator.SetBool('Jump',false);
if(Input.GetButton('Run'))
animator.SetButton('Run',true);
else
Animator.Set.Bool('Bieg',false);
}
function FixedUpdate () {
var h : float = Input.GetAxis("Mouse X");
transform.Rotate(0, h, 0);
animator.SetFloat ("Speed", v);
animator.SetFloat ("Direction", h);
}
if(Input.GetKeyDown(KeyCode.Tab)){
Screen.showCursor = false;
}
else
{
Screen.showCursor = true;
}
Answer by SkaredCreations · Mar 23, 2014 at 07:10 PM
As the error says: SetButton does not exist, look at the Animator documentation please. Also you're writing the latest piece of code ("if(Input.GetKeyDown(KeyCode.Tab)){" etc) out of any function, it should stay inside the function Update. And "Animator.Set.Bool" (inside your Update) does not exist, it should be: animator.SetBool('Bieg',false);
By the way I noticed you fixed your FixedUpdate code with my answer, but you forgot to mark the answer as accepted, you should accept the answers if they work so that everyone else having an issue can take advantage of the solutions.
Your answer
![](https://koobas.hobune.stream/wayback/20220613141004im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Some wierd problem. 1 Answer
Character getting stuck on curbs.. 0 Answers
Help with movement script 2 Answers
Switch Case for Basic AI.... 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers