protected override void Start() { if (m_dataBinder != null) { setButtonState(m_dataBinder.GetCurrentData(), true); // Initilize widget value } else { setButtonState(false, true); } }
// Stop listening to any previous data binder and start listening to the new one. public void RegisterDataBinder(LMWidgets.DataBinder <LMWidgets.ButtonToggleBase, bool> dataBinder) { if (dataBinder == null) { return; } UnregisterDataBinder(); m_dataBinder = dataBinder as DataBinderToggle; setButtonState(m_dataBinder.GetCurrentData()); }
// Use this for initialization void Start() { if (m_ToggleController != null) { m_ToggleController.DataChangedHandler += OnToggleChanged; bool currentBool = m_ToggleController.GetCurrentData(); if (currentBool == true) { iconImage.texture = OnTexture; } else { iconImage.texture = OffTexture; } } }