Skip to content

Commit 7b4a864

Browse files
committed
fix #67, minor fixes
1 parent 0763d9c commit 7b4a864

File tree

6 files changed

+65
-25
lines changed

6 files changed

+65
-25
lines changed

Assets/Testing/AWS1HourTest.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ PrefabInstance:
12031203
- target: {fileID: 2834388984357925155, guid: 0a3b6392f04558844bd340e68ced1ff9,
12041204
type: 3}
12051205
propertyPath: m_AnchoredPosition.y
1206-
value: 1105
1206+
value: 1235
12071207
objectReference: {fileID: 0}
12081208
- target: {fileID: 2896031059644693069, guid: 0a3b6392f04558844bd340e68ced1ff9,
12091209
type: 3}
@@ -1253,7 +1253,7 @@ PrefabInstance:
12531253
- target: {fileID: 4267567203292169432, guid: 0a3b6392f04558844bd340e68ced1ff9,
12541254
type: 3}
12551255
propertyPath: m_AnchoredPosition.y
1256-
value: 2040
1256+
value: 2280
12571257
objectReference: {fileID: 0}
12581258
- target: {fileID: 4612929069887686480, guid: 0a3b6392f04558844bd340e68ced1ff9,
12591259
type: 3}

Assets/UXF/Prefabs/Form.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/UXF/Scripts/Etc/Editor/UXFSessionDisplay.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ static void FetchReferences()
7373
Dictionary<string, object> trialDict = new Dictionary<string, object>();
7474
// log each trial setting
7575
foreach (string key in trial.settings.Keys)
76-
trialDict.Add(key, trial.settings.GetObject(key).ToString());
76+
{
77+
var val = trial.settings.GetObject(key);
78+
trialDict.Add(key, val?.ToString() ?? "(null)");
79+
}
7780

7881
// add trial to block
7982
trialList.Add(trialDict);

Assets/UXF/Scripts/Etc/ReorderableInspector/Editor/ReorderableArrayInspector.cs

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ public void AddProperty(SerializedProperty property)
101101

102102
propList.drawElementCallback = delegate (Rect rect, int index, bool active, bool focused)
103103
{
104-
SerializedProperty targetElement = property.GetArrayElementAtIndex(index);
104+
SerializedProperty targetElement;
105+
try
106+
{
107+
targetElement = property.GetArrayElementAtIndex(index);
108+
}
109+
catch (NullReferenceException)
110+
{
111+
return;
112+
}
105113

106114
bool isExpanded = targetElement.isExpanded;
107115
rect.height = EditorGUI.GetPropertyHeight(targetElement, GUIContent.none, isExpanded);
@@ -148,7 +156,15 @@ public void AddProperty(SerializedProperty property)
148156

149157
private float ElementHeightCallback(SerializedProperty property, int index)
150158
{
151-
SerializedProperty arrayElement = property.GetArrayElementAtIndex(index);
159+
SerializedProperty arrayElement;
160+
try
161+
{
162+
arrayElement = property.GetArrayElementAtIndex(index);
163+
}
164+
catch (NullReferenceException)
165+
{
166+
return 0f;
167+
}
152168
float calculatedHeight = EditorGUI.GetPropertyHeight(arrayElement,
153169
GUIContent.none,
154170
arrayElement.isExpanded);
@@ -319,7 +335,9 @@ protected virtual void InitInspector()
319335
if (isInitialized && FORCE_INIT == false)
320336
return;
321337

322-
styleEditBox = new GUIStyle(EditorStyles.helpBox) { padding = new RectOffset(5, 5, 5, 5) };
338+
try { styleEditBox = new GUIStyle(EditorStyles.helpBox) { padding = new RectOffset(5, 5, 5, 5) }; }
339+
catch (NullReferenceException) { return; }
340+
323341
FindTargetProperties();
324342
FindContextMenu();
325343
}
@@ -612,7 +630,11 @@ public override void OnInspectorGUI()
612630

613631
if (EditorGUI.EndChangeCheck())
614632
{
615-
serializedObject.ApplyModifiedProperties();
633+
try
634+
{
635+
serializedObject.ApplyModifiedProperties();
636+
}
637+
catch (System.Exception) { return; }
616638
InitInspector(true);
617639
}
618640

@@ -630,27 +652,34 @@ protected void IterateDrawProperty(SerializedProperty property, Func<IterControl
630652
{
631653
if (property.NextVisible(true))
632654
{
633-
// Remember depth iteration started from
634-
int depth = property.Copy().depth;
635-
do
655+
try
636656
{
637-
// If goes deeper than the iteration depth, get out
638-
if (property.depth != depth)
639-
break;
640-
if (isSubEditor && property.name.Equals("m_Script"))
641-
continue;
642-
643-
if (filter != null)
657+
// Remember depth iteration started from
658+
int depth = property.Copy().depth;
659+
do
644660
{
645-
var filterResult = filter();
646-
if (filterResult == IterControl.Break)
661+
// If goes deeper than the iteration depth, get out
662+
if (property.depth != depth)
647663
break;
648-
if (filterResult == IterControl.Continue)
664+
if (isSubEditor && property.name.Equals("m_Script"))
649665
continue;
650-
}
651666

652-
DrawPropertySortableArray(property);
653-
} while (property.NextVisible(false));
667+
if (filter != null)
668+
{
669+
var filterResult = filter();
670+
if (filterResult == IterControl.Break)
671+
break;
672+
if (filterResult == IterControl.Continue)
673+
continue;
674+
}
675+
676+
DrawPropertySortableArray(property);
677+
} while (property == null || property.NextVisible(false));
678+
}
679+
catch (NullReferenceException)
680+
{
681+
return;
682+
}
654683
}
655684
}
656685

Assets/UXF/Scripts/Etc/Trial.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void End()
144144
// log any settings we need to for this trial
145145
foreach (string s in session.settingsToLog)
146146
{
147-
result[s] = settings.GetObject(s);
147+
result[s] = settings.GetObject(s, string.Empty);
148148
}
149149

150150
session.onTrialEnd.Invoke(this);

Assets/UXF/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.2
1+
2.1.3

0 commit comments

Comments
 (0)