Created
May 30, 2011 19:11
-
-
Save jeedee/999338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class Example : MonoBehaviour | |
{ | |
// The below references should be populated | |
// by dragging the desired controls from | |
// scene hierarchy onto these variables in | |
// the inspector: | |
// Reference to a slider | |
public UISlider slider; | |
// Reference to a radio button | |
public UIRadioBtn radioBtn; | |
void Start() | |
{ | |
// Register our delegate with both controls: | |
slider.SetValueChangedDelegate(MyDelegate); | |
radioBtn.SetValueChangedDelegate(MyDelegate); | |
} | |
// The delegate itself | |
void MyDelegate(IUIObject obj) | |
{ | |
if(obj == slider) | |
Debug.Log("The slider's value is: " + slider.Value); | |
else if(obj == radioBtn) | |
Debug.Log("The radio button's value is: " + radioBtn.Value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment