Hello everyone, been looking around and i cant seem to figure out why this problem pops up, so i was hoping some smart person could help me out.
The problem is that the code runs just fine until i reaches WaitForSeconds, it seems that WaitForSeconds doesent run at all leaving my screen green till i change the GUITexture with another function.
Heres the code:
public GUITexture splash;
public Player player;
// Use this for initialization
void Start ()
{
splash.enabled = false;
}
// Update is called once per frame
void Update ()
{
}
void OnTriggerEnter(Collider col)
{
if(col.gameObject.tag == "Player")
{
StartCoroutine(SplashPickUp(0.2f));
player.Armor += 20;
Destroy(gameObject);
}
}
IEnumerator SplashPickUp(float cooldown)
{
splash.enabled = true;
splash.color = Color.green;
yield return new WaitForSeconds(cooldown);
splash.enabled = false;
}