public static InputField FindInputAndAddFloatHandlers(GameObject parentGO, string inputName, Func <float> getValue, Action <float> setValue, float minValue, float maxValue) { var field = UnityUtil.FindChildByName(parentGO, inputName).GetComponent <InputField>(); AddFloatHandlers(field, getValue, setValue, minValue, maxValue); return(field); }
public static Dropdown FindDropDownAndAddHandlers(GameObject parentGO, string inputName, Func <int> getValue, Action <int> setValue, int minValue, int maxValue) { var dropdown = UnityUtil.FindChildByName(parentGO, inputName).GetComponent <Dropdown>(); DropDownAddHandlers(dropdown, getValue, setValue, minValue, maxValue); return(dropdown); }
public static Text FindTextAndSet(GameObject parentGO, string textName, string newText) { var text = UnityUtil.FindChildByName(parentGO, textName).GetComponent <Text>(); text.text = newText; return(text); }
public static Toggle FindToggleAndConnectToSource(GameObject parentGO, string toggleName, Func <bool> getValue, Action <bool> setValue) { var toggle = UnityUtil.FindChildByName(parentGO, toggleName).GetComponent <Toggle>(); ToggleConnectToSource(toggle, getValue, setValue); return(toggle); }
public static Button FindButtonAndAddToggleBehavior(GameObject parentGO, string buttonName, Func <bool> getValue, Action <bool> setValue, Action <bool, Button> updateF, bool bWatchForUpdates = false) { var button = UnityUtil.FindChildByName(parentGO, buttonName).GetComponent <Button>(); AddToggleBehavior(button, getValue, setValue, updateF, bWatchForUpdates); return(button); }
public static Button FindButtonAndAddClickHandler(GameObject parentGO, string buttonName, UnityAction handler) { var button = UnityUtil.FindChildByName(parentGO, buttonName).GetComponent <Button>(); if (handler != null) { button.onClick.AddListener(handler); } return(button); }
public static Toggle FindToggleAndAddHandler(GameObject parentGO, string toggleName, UnityAction <bool> handler) { var toggle = UnityUtil.FindChildByName(parentGO, toggleName).GetComponent <Toggle>(); if (handler != null) { toggle.onValueChanged.AddListener(handler); } return(toggle); }
public static Toggle FindToggleAndSet(GameObject parentGO, string toggleName, bool value) { var toggle = UnityUtil.FindChildByName(parentGO, toggleName).GetComponent <Toggle>(); if (toggle != null) { toggle.isOn = value; } return(toggle); }
public static Dropdown FindDropDownAndAddHandlers(GameObject parentGO, string inputName) { return(UnityUtil.FindChildByName(parentGO, inputName).GetComponent <Dropdown>()); }
public static InputField FindInput(GameObject parent, string inputName) { var field = UnityUtil.FindChildByName(parent, inputName).GetComponent <InputField>(); return(field); }
public static Text FindText(GameObject parentGO, string textName) { return(UnityUtil.FindChildByName(parentGO, textName).GetComponent <Text>()); }