Quantcast
Channel: Latest Questions by GraviterX
Viewing all articles
Browse latest Browse all 122

OnGUI coroutine issue

$
0
0
Hey all. I'm trying to make a script for the intro to my game so when the Player walks through a trigger, GUI Text appears, then fades away. I have one script that makes it appear ontriggerenter, and I have one that fades. However, the one that fades activates when the game starts. I drew up this script to try and use both features to suit my need. However I encountered a problem. I get a console error saying that onGUI cannot be declared as a coroutine. How can I fix this? var lightGameObject : GameObject; function Start() { lightGameObject.enabled = false; } function Update() { if(Input.GetMouseButtonDown(0)) { lightGameObject.enabled = true; yield WaitForSeconds(1); lightGameObject.enabled = false; } } The error : OnGUI() can not be a coroutine.

Viewing all articles
Browse latest Browse all 122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>