Hi everyone,
This is probably stupidly easy, but I’m busting my brains with this.
I made this Enum
public enum EyeState{Enabled, disabled, destroyed};
Then created the variable in a monobehaviour
public class EyesDamageReciever : MonoBehaviour {
public EyeState myState;
The idea is, that when the player deals damage to it, instead of simply destroy the object it changes the enum value.
IEnumerator CheckLife()
{
rend.material.color = Color.red;
yield return new WaitForSeconds (0.25f);
if (currentHP <= 0)
{
if (myState == EyeState.Enabled)
{
myAI.EyeDestroyed(this.name);
//ChangeMyState(myState);
myState = EyeState.disabled;
}
}
yield return new WaitForSeconds (0.25f);
rend.material.color = Color.white;
yield break;
}
But nothing is happening. I tried debugging it and a warning saying “The requested item has been unloaded” I don’t know if this has something to do with the problem. I googled the warning but every result says they have problem reading the variable. I’m having problems changing it.
Any solutions? Am I making a wrong use of enums?
Sorry for my horrible english…