- Home /
enum not referencing properly
So I have an attack script and a character controller script. I have an enum in my character controller script for basic animations (run, jump, fall etc.) and I have animations in my attack script such as jab. Here is my enum for my character controller script:
public enum State { idle, running, jumping, falling }
here is the way I referenced my enumerator:
if (ahmadcontroller.state == Ahmadcontroller.State.idle)
{
animator.SetTrigger("cross");
}
else
{
animator.SetTrigger("rcross");
}
yet it isn't working. How do I fix this?
i honestly do not understand. What exactly does not work?
"it does not reference properly" does not really have any meaning.
Could you please explain in a bit more detail what isn't working ? Is your IF statement not running or ahmadcontroller.state not set properly or .. ?
Answer by krispastas · Jun 30, 2020 at 01:28 PM
public enum State { idle, running, jumping, falling }
public State state;
if (state == State.idle)
{
animator.SetTrigger("cross");
}
else
{
animator.SetTrigger("rcross");
}
Your answer
Follow this Question
Related Questions
Enums compare question C# 1 Answer
Using C# Enums to Control an Animator 2 Answers
Animation in response to a user response? 0 Answers
How to play and repeat an animation whenever i shoot a bullet ? 1 Answer
C# Enum for Animation Issue 1 Answer