Hi,
I'm very new to NGUI and Unity in general - never used the previous versions or the current Unity GUI for that matter.
I'm working on my very first panel, on which I've decided to plonk a bunch of toggle buttons to make up a radio group.
Please keep in mind this is just example functionality so that I can learn about NGUI radio buttons.
I'm setting my target FPS in my application - to do that I've set up 5 toggle buttons for the different values I want to set.
Then I've attached a script to a "FpsRadioGroup" parent container, with these functions:
private void SetTargetFramerate(int target){
Application.targetFrameRate = target;
GameManager.Instance.LogInfo(
"attempted to target framerate {0}, application now reports {1}",
target, Application.targetFrameRate);
}
public void On15FpsSelected(){
if( UIToggle.current.value ){
SetTargetFramerate(15);
}
}
public void On30FpsSelected(){
if (UIToggle.current.value) {
SetTargetFramerate(30);
}
}
public void On60FpsSelected(){
if (UIToggle.current.value) {
SetTargetFramerate(60);
}
}
...
I was hoping to have NGUI just call the SetTargetFramerate() method directly with a parameter, or something similar (was originally thinking I'd be able to pass in an enum).
Am I missing something - or is making a callback method for each toggle button in the radio group the right way to do it?