VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
override void AVR.Core.Attributes.FoldoutPropertyDrawer.OnGUI ( Rect  position,
SerializedProperty  property,
GUIContent  label 
)
inline

Definition at line 64 of file AVR_Attributes_PropertyDrawers.cs.

65  {
66  // TL;DR: If the reference object is changed (by for instance selecting a different object in the inspector, or when drawing multpile objects with foldout-groups)
67  // then we reset the prop-reference and last-group, as not to interfere with the foreign object.
68  if(obj_reference==null) obj_reference = property.serializedObject.targetObject;
69  else if(obj_reference!=property.serializedObject.targetObject) {
70  prop_reference = null;
71  last_group = null;
72  obj_reference = property.serializedObject.targetObject;
73  }
74 
75  // TL;DR: prop_reference acts as a cycle reference. if prop_reference==property.name, that means we are drawing a property we have already drawn previously
76  // meaning, we are in a brand new OnGUI cycle. Respectively, we need to reset the last_group variable.
77  if(prop_reference==null) prop_reference = property.name;
78  else if(prop_reference==property.name) {
79  last_group = null;
80  }
81 
82  // Get attribute
83  FoldoutGroup attr = attribute as FoldoutGroup;
84 
85  if(last_group!=attr.group_id) {
86  NewGroup(attr.group_id, property);
87  }
88  else {
89  ContinuationGroup(property);
90  }
91  }
void NewGroup(string group_name, SerializedProperty prop)