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…
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour
{
public Game gamescript;
public UILabel label;
void Awake()
{
UIProgressBar pg = GetComponent<UIProgressBar>();
EventDelegate.Add(pg.onChange, MyFunc);//1
EventDelegate.Add(pg.onChange, gamescript.MyFunc);//trying to call method from other class//2
EventDelegate.Add(pg.onChange, Func);//3
}
void MyFunc ()
{
float NegativeOneToOne = UIProgressBar.current.value * 100.0F - 50.0F; // make 0 to 1 slider value mapped to -1 to 1
label.text = NegativeOneToOne.ToString("F");
}
void Func()
{
Debug.Log ("Called");
}
}
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