Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Unknowns

Pages: [1]
1
NGUI 3 Support / Re: Add Delay to UIEventTrigger
« on: June 23, 2014, 03:44:11 PM »
Thanks to you both.  :)

2
NGUI 3 Support / Re: Add Delay to UIEventTrigger
« on: June 23, 2014, 01:44:55 PM »
I'm not sure exactly what you mean, but if you're trying to load a scene at a button press, but want the animation and sound to finish before doing so, you could try an Update loop or a coroutine WaitForSeconds(); you can look up how to do coroutines in the Unity documentation. Although that might be a little elaborate for your needs.

The simpler solution might be the update loop. It's probably not ideal, since coroutines are probably more efficient, but it's easier to implement:
  1. Update ()
  2. {
  3.    if (Time.time > nextTime)
  4.    {
  5.       Application.LoadLevel(levelToLoad);
  6.    }
  7. }
  8.  
  9. Button ()
  10. {
  11.    nextTime = Time.time + 1.0f; //delay in seconds
  12.    levelToLoad = 0; //level you want to load
  13. }
  14.  

Just set your delay as long as you need to complete the tween and audio. :)

Thank You!.  :)

I try to explain a little more detailed, but is more or less as you say.

I have a  "ButtonControl" Script that I made to control all my buttons from a centralized location:

Example:

  1. public void buttonPlay (){
  2.  
  3. Application.LoadLevel("Play");
  4.  
  5. }
  6. public void buttonAbout (){
  7.  
  8. Application.LoadLevel("About");
  9.  
  10. }
  11. public void buttonGooglePlus (){
  12.  
  13. Application.OpenURL("");
  14.  
  15. }

A "button" is composed by:



The "UIEventTrigger" - "On Release", notify to the  "ButtonControl" Script and  "SoundEffects" Script, the first do something (Load a level, open a url, etc...), the second play a "click" sound, but when is pressed the "Tween Scale" and the Sound are cut off, I want to add a delay to prevent this.

I know how to add the delay (Invoke, coroutine WaitForSeconds(); as you say, etc...),  but not how to keep control of all buttons in a single Script with these methods. (Not even know if it's possible.)

 :)

3
NGUI 3 Support / Add Delay to UIEventTrigger
« on: June 23, 2014, 11:23:10 AM »
Hi,

I have a script that controls all the buttons:

public void NameButon1 () {}
public void NameButton2 () {}
etc...

The Script work well, but when pressed directly loaded the scene, cutting the sound of the "click" and the "Tween Scale", these button are "UI2DSprite" controlled by a "UIEvent Trigger" How can add a delay to those "buttons" in "On Relase" for example?

Thanks!.  :)

Pages: [1]