VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.UI.Link.AVRUI_Link_Toggle.updateOutput ( )
inlinevirtual

Method is run continously from OnGUI. This method should update the value displayed by the UI when the target value changes.

Implements AVR.UI.Link.AVRUI_Link.

Definition at line 70 of file AVRUI_Link_Toggle.cs.

71  {
72  bool current_value = false;
73 
74  switch (memberType)
75  {
76  case MemberType.FIELD:
77  {
78  current_value = (bool)target.GetType().GetField(field).GetValue(target);
79  break;
80  }
81  case MemberType.PROPERTY:
82  {
83  current_value = (bool)target.GetType().GetProperty(field).GetValue(target);
84  break;
85  }
86  }
87 
88  input.isOn = current_value;
89 
90 #if UNITY_EDITOR
91  if (old_value != current_value.ToString() && !Application.isPlaying)
92  {
93  EditorUtility.SetDirty(input);
94  old_value = current_value.ToString();
95  }
96 #endif
97  }