- Home /
Enable and object after disable
Hello everyone,
I've been having a bit of a problem with enabling an object after I disable it. Here's the script I've been using:
var timer = 5.0; var respawnTimer = 3.0;
function Start() { TimedFunction (); }
function Update() { Invoke ("TimedFunction", timer); }
function TimedFunction() { renderer.enabled = false; yield WaitForSeconds (respawnTimer); renderer.enabled = true; print ("OK"); }
It prints "OK", but the object doesn't disable. If I take the yield out of the script, then the object only disables and doesn't come back. Any suggestions?
Thank you for your help.
Jeremiah
Your answer
![](https://koobas.hobune.stream/wayback/20220613120034im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to basically use GUI.Toggle? 2 Answers
enable and disable boxcollider (whats wrong with my script?) 2 Answers
error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer 3 Answers
Making a Game object appear and dissapear 3 Answers
Load a GameObject that is outside of script and set it active at the same time 1 Answer