Question by
basharmilesteg42 · Nov 24, 2021 at 08:55 AM ·
bugif-statementsif-else
If else block acts extremely weird
Hello, I've created an if else block. but if condition does not get true, but I'm %100 sure it's true. Is this because encoding of letters? And code enters to if at the first if in foreach loop, I added that later. And it was working before. I think this is a meta bug. Not a logic bug. Maybe because of different usage of IDEs...
Your input and help is appreciated.
public void UpdateAnimationTimes() { AnimationClip[] clips = animator.runtimeAnimatorController.animationClips; foreach (AnimationClip clip in clips) { // ENTERS HERE if (clip.name == ANIM_STRIKE) { Debug.Log("Enters here."); } if (clip.name == ANIM_LEDGE_CLIMB) { Debug.Log("ledge"); } else if (clip.name == ANIM_MEDITATION) { animMeditationTime = clip.length; } // BUT DOES NOT ENTER HERE, SAME CONDITION ABOVE?! else if (clip.name == ANIM_STRIKE) { animStrikeTime = clip.length; } else if (clip.name == ANIM_STRIKE_2) { animStrike2Time = clip.length; } else if (clip.name == ANIM_STRIKE_3) { animStrike3Time = clip.length; } else if (clip.name == ANIM_STRIKE_HOLD) { animStrikeHoldTime = clip.length; } else if (clip.name == ANIM_ATTACK) { animAttackTime = clip.length; Debug.Log("Anim attack time: "+ animAttackTime); } } }
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613045738im_/https://answers.unity.com/themes/thub/images/avi.jpg)