|
Hey :) .. How would i put a delay in this.. to go in to more detail i want a delay just before my GuiTexture activates This is the code it all works but i want a delay off like 3 seconds befor it actully activates anybody know how to do this??... var Aim : boolean = false; var SnipeTexture : GUITexture; function Update () { } Thanks.
(comments are locked)
|
|
add this to your code:
EDIT - C# Example: Where about :P i have tried this method but i don't know where to put it :P
Nov 04 '11 at 02:21 PM
UnityNeewb
I think you would want it at the beginning of Update() or just before the activation of your GUI script in some other script that activates the GUI object/component.
Nov 04 '11 at 03:02 PM
andresp
Nope doesn't work
Nov 04 '11 at 03:12 PM
benjimazza
it works. you can't use it inside Update but you can you use StartCoroutine to start a method that can use yield (just as you can see in the link that I posted). "Note that you can't use yield from within Update or FixedUpdate, but you can use StartCoroutine to start a function that can."
Nov 04 '11 at 03:53 PM
andresp
You can't use yield from within Update, because that would cause the game to hang for a frame! (which it can't because it would be waiting for the update loop to finish, which itself would be waiting for the update loop to finish.)
Nov 04 '11 at 03:59 PM
syclamoth
(comments are locked)
|
var repeating : boolean = false; Hey Thanks for the comment, but there's a problem with this code all this code does is make a counter so that when i hold the RMB it started counting and it goes on for ever and ever and ever Any ideas ??
Nov 04 '11 at 05:51 PM
UnityNeewb
Try now, let´s see if it helps !
Nov 04 '11 at 05:58 PM
cj_coimbra
This works great :) how would i change this code so that instead of the GUITexture it was a camera ??
Nov 04 '11 at 06:17 PM
UnityNeewb
What do you mean? Switch to another camera?
Nov 04 '11 at 06:21 PM
cj_coimbra
Yeh :) so basicly instead of the GUITexture been activated in 3 seconds the camera is activated in 3 seconds if that makes sense, so basicly instead of the GUITexture its the camera ??
Nov 04 '11 at 06:25 PM
UnityNeewb
(comments are locked)
|
Then, call it from Update inside of i get one error Assets/Scripts/Texture.js(4,28): BCE0043: Unexpected token: onOff. Any Clue ??
Nov 04 '11 at 04:53 PM
UnityNeewb
(comments are locked)
|

Do you want the delay when it starts as well as when it stops, or just when it starts?