I need help with my code. What I need to do is when my game runs into a certain enum (state) I need it to subtract one number, only once. But when I do it it shows that it is constantly subtracting. Can anyone help me how do I set it up to where it subtract one number every time it enters into a specific enum state? Many thanks in advance.
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class GUIWindow : MonoBehaviour {
public enum MyEnum {stuff1, stuff2}
public MyEnum CurrentEnum = MyEnum.stuff1;
int value1 = 800;
void Start()
{
}
void Update()
{
switch (CurrentEnum)
{
case MyEnum.stuff1:
value1--;
Debug.Log(value1);
break;
}
}
}