- Home /
Question by
maximilii · Mar 24 at 02:09 AM ·
parameters
can't find the parameter
alt textHello, sorry for my English.... I got this error, it tells me that it can't find the parameter... the parameter is done, I don't understand why it can't find it...
public class PlayerMove : MonoBehaviour { public float runSpeed = 2;
public float jumpSpeed = 3;
Rigidbody2D rb2D;
public bool betterJump = false;
public float fallMultiplayer = 0.5f;
public float lowJumpMultiplayer = 1f;
public SpriteRenderer spriteRenderer;
public Animator animator;
void Start()
{
rb2D = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
if (Input.GetKey("d") || Input.GetKey("right"))
{
rb2D.velocity = new Vector2(runSpeed, rb2D.velocity.y);
spriteRenderer.flipX = false;
animator.SetBool("Run", true);
}
else if(Input.GetKey("a") || Input.GetKey("left"))
{
rb2D.velocity = new Vector2(-runSpeed, rb2D.velocity.y);
spriteRenderer.flipX = true;
animator.SetBool("Run", true);
}
else
{
rb2D.velocity = new Vector2(0, rb2D.velocity.y);
animator.SetBool("Run", false);
}
error.jpeg
(159.8 kB)
Comment
Answer by JACLEMGO · Mar 24 at 02:54 AM
The error means your Animator Controller doesn't have a bool parameter called "Run", example:
runanimatorrun.png
(9.2 kB)
Your answer
Follow this Question
Related Questions
GUI Placement Question. 1 Answer
accessing custom url parameters on android 1 Answer
Unityscript how to change parameters value 1 Answer
Reflection - passing parameters to an invoked function 2 Answers
space wrap 3D 1 Answer