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 - freesmith

Pages: [1]
1
NGUI 3 Support / Re: UISlider OnValueChange Call Multiple Methods
« on: March 13, 2014, 10:55:27 AM »
I updated to the latest version and the feature works as it should. Thanks for update and reply!

2
NGUI 3 Support / UISlider OnValueChange Call Multiple Methods
« on: March 12, 2014, 11:36:42 AM »
Hi all,
I'm using unity 4.3.2f1 and NGUI  Version 3.0.9 f5

And I have a problem with OnValueChange notify feature in UISlider.
on ui slider value changed ,I want to notify more than one object, and call some of its methods.
only the first referenced object (in the notify slot) and method works, i can add manually more objects and methods, but they dont get called.(or notified)
i tried with this code, to call 2 methods from the same class , and one from different one...
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Test : MonoBehaviour
  5. {
  6.         public Game gamescript;
  7.         public UILabel label;
  8.         void Awake()
  9.         {
  10.                 UIProgressBar pg = GetComponent<UIProgressBar>();
  11.                 EventDelegate.Add(pg.onChange, MyFunc);//1
  12.                 EventDelegate.Add(pg.onChange, gamescript.MyFunc);//trying to call method from other class//2
  13.                 EventDelegate.Add(pg.onChange, Func);//3
  14.         }
  15.         void MyFunc ()
  16.         {
  17.                 float NegativeOneToOne = UIProgressBar.current.value * 100.0F - 50.0F; // make 0 to 1 slider value mapped to -1 to 1
  18.                 label.text = NegativeOneToOne.ToString("F");
  19.         }
  20.         void Func()
  21.         {
  22.                 Debug.Log ("Called");
  23.         }
  24. }
And again, whatever the method, the first one on the list is called ,the others not.
Anyone any ideas how to solve this?
Thank you

Pages: [1]