i got this script, i made it, but i have no idea what im doing, so i need some help ![]()
it isnt working sadly
void Awake()
{
open = 0;
anim = GetComponent<Animator>();
}
void Update ()
{
if(Input.GetButtonDown("Use") && open == 1)
{
open = 0;
anim.SetBool("open", false);
}
else if(Input.GetButtonDown("Use") && open == 0)
{
open = 1;
anim.SetBool("open", true);
}
}
What is it even supposed to do? This looks like gibberish.
– tw1st3di have an open/ close animation in my animator, this script is attached to the gate i want opend and closed, for now, i want my script, when i press use, to set the bool in my animator to true or false if it already is true
– loxfearwithout your mecanim structure it will be hard to help you. Cause maybe your problem comes from your Mecanim model ?
– lisztoi have an animator on my gate, same gate where my script is. in the animator i got a controller called OpenDoor. in there i made a bool called open. if i turn the bool true while playing the game, the animation plays in the game, but i dont know how to get to it through the script
– loxfearit's strange cause I do the same thing in C# and it works for me. I mean the animator.SetBool( "MyBool", boolValue )
– liszto