I’m having trouble getting a variable to increase I’ve looked backed over the create with code course and still cant see why it wont work. the if statement in update never runs even when it should be found as true here is the code I have if anyone can help it would be much apricated.
public class JewelConutroller : MonoBehaviour
{
public float jewelCount = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (jewelCount > 1)
{
Debug.Log("Yay");
}
}
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.CompareTag("Player"))
{
increaseJewelCount();
Destroy(gameObject);
}
}
private float increaseJewelCount()
{
jewelCount += 1f;
return jewelCount;
}
}