Skip to content

Commit 7ea0be7

Browse files
committed
Bug fixes
1 parent c4b8202 commit 7ea0be7

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

Scripts/Editor/UViewWindow.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEngine.SceneManagement;
33
using UnityEditor;
44
using System.Collections;
@@ -89,8 +89,10 @@ protected void OnGUI()
8989
for(; i<l; ++i) names[i] = controllers[i].gameObject.name;
9090

9191
int index = System.Array.IndexOf<ViewController>(controllers,_viewController);
92+
if(index<0) index = 0;
93+
9294
index = EditorGUILayout.Popup("View Controller",index,names);
93-
controller = controllers[index];
95+
controller = index>=0 && index<controllers.Length ? controllers[index] : null;
9496
}
9597

9698
if(controller!=_viewController){
@@ -99,7 +101,7 @@ protected void OnGUI()
99101
_viewController = controller;
100102
}
101103

102-
_viewControllerEditor.OnInspectorGUI();
104+
if(_viewControllerEditor!=null) _viewControllerEditor.OnInspectorGUI();
103105

104106
} else {
105107

@@ -188,4 +190,4 @@ private void DrawSettingsGUI()
188190

189191
}
190192

191-
}
193+
}

Scripts/Editor/ViewControllerEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public override void OnInspectorGUI ()
6767
private void DrawStatsGUI()
6868
{
6969
ViewController viewController = target as ViewController;
70+
if(viewController==null || viewController.currentLocation==null) return;
7071

7172
UViewEditorUtils.LayoutLabelWithPrefix("Loaded Resources",viewController.loadedResourceCount);
7273

Scripts/Editor/ViewList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22
using UnityEditor;
33
using UnityEditorInternal;
44
using System.Collections;
@@ -119,4 +119,4 @@ private void OnSelectedCallback(ReorderableList list)
119119

120120
}
121121

122-
}
122+
}

Scripts/ViewController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public AbstractView[] showingOverlays {
141141
public int loadedResourceCount {
142142
get {
143143
int count = 0;
144-
foreach(ViewAsset asset in _assetLookup.Values) if(asset.IsResourceLoaded) count++;
144+
if(_assetLookup!=null) foreach(ViewAsset asset in _assetLookup.Values) if(asset.IsResourceLoaded) count++;
145145

146146
return count;
147147
}

0 commit comments

Comments
 (0)