x


how OnTriggerStay Have a time

Please help if the gameobject stay thre at 3 secont the GUI will appear thx

here is the Code

void OnTriggerStay(Collider collision) {

bShoGUI = false;

}

if the timer is = 3 secont the GUI will appear thx Im new to Unity3d

more ▼

asked Jul 09 '12 at 05:14 PM

bantex07 gravatar image

bantex07
1 1

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Try this:

   float  t = 0;

   void OnTriggerEnter(Collider other) 
   {
      t = 0;
   }

   void OnTriggerStay(Collider other)
   {
        t += Time.deltaTime;
        if(t > 3) {
           //Do something
        }
   }
more ▼

answered Jul 09 '12 at 05:24 PM

whydoidoit gravatar image

whydoidoit
32.9k 11 23 98

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1938

asked: Jul 09 '12 at 05:14 PM

Seen: 232 times

Last Updated: Jul 09 '12 at 05:24 PM