- Home /
NGUI UISlider OnValue Change Notify Problem
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
Answer by Freesmith · Mar 13, 2014 at 04:32 PM
I updated NGUI to the latest version and the feature works as it should.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140104im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why is InvokeRepeating not working in boolean method? 0 Answers
Integer Getter Method always returns zero 3 Answers
How can I call a method from another script? 3 Answers
Does Unity not like methods inside of other ones? 2 Answers
what is wrong whis this? 1 Answer