- Home /
cannot implicitly convert type void to bool
im having this error in my code right here why ?
Animator anim;
if (anim.SetTrigger("Trigger")){
Poop = !Poop;
ShowCorrect = false;
ShowIncorrect = false;
}
i dont know why im getting that kind of error all i want is when my animation on my animator is playing poop will be false and etc
do you $$anonymous$$d if you submit the whole code well at lease the function
ahh because what i want is when my animation is playing I wannt my Poop button to be false and since anim.SetTrigger("Trigger")is the one making the animation run i thought its the one that i should code with if so my poop button will be false so what should i do so that when my animation from my animator is playing i want my poop button to be false
What's wrong with just:
anim.SetTrigger("Trigger");
Poop = false;
?
its not working with that, i think i really need to do a if statement with that and i dont know how
Answer by meat5000 · Aug 08, 2014 at 10:30 AM
As tanoshimi says, anim.SetTrigger() is void. It just does a job, and doesn't talk to you about it.
You can't test against it in an if statement.
ahh because what i want is when my animation is playing I wannt my Poop button to be false and since anim.SetTrigger("Trigger")is the one making the animation run i thought its the one that i should code with if so my poop button will be false so what should i do so that when my animation from my animator is playing i want my poop button to be false
Try this
with .IsName(""); to check the animation is playing
Your answer
Follow this Question
Related Questions
Animation in Unity 4.3 0 Answers
Is it a way to get the animation object form the animator? 0 Answers
Animation component in Unity 4.3 doesn't work? 2 Answers
2D Animation does not start 1 Answer