- Home /
Question by
MontyMomentum · Jun 23, 2020 at 03:14 PM ·
animationanimator controllerboolean
If statement result not working
I'm using an If statement to see whether an integer has reached a certain number but the results don't make any sense to me, I put a debug.log with the value of the integer when the If statement is true but it goes off non stop while displaying the correct number.
Here's my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goal : MonoBehaviour
{
public Animator anim;
private static int scoreCoin;
public int aantCoin;
// Start is called before the first frame updateS
void Start()
{
}
// Update is called once per frame
void Update()
{
scoreCoin = Collector.score;
if (scoreCoin >= aantCoin);
{
anim.SetBool("Goal", true);
Debug.Log(scoreCoin);
}
}
}
Comment
Best Answer
Answer by MiB775 · Jun 23, 2020 at 08:59 PM
You shouldn't put the semicolon after an if statement.
I am embarrassed to admit how long I was agonizing over this, thank you so much for pointing that out.