This repository was archived by the owner on May 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +36
-14
lines changed Expand file tree Collapse file tree 7 files changed +36
-14
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ namespace UnityExplorer
17
17
public class ExplorerCore
18
18
{
19
19
public const string NAME = "UnityExplorer" ;
20
- public const string VERSION = "3.2.3 " ;
20
+ public const string VERSION = "3.2.4 " ;
21
21
public const string AUTHOR = "Sinai" ;
22
22
public const string GUID = "com.sinai.unityexplorer" ;
23
23
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public bool Enabled
21
21
}
22
22
23
23
24
- public abstract void Init ( ) ;
24
+ public abstract bool Init ( ) ;
25
25
public abstract void Update ( ) ;
26
26
}
27
27
}
Original file line number Diff line number Diff line change 12
12
using UnityEngine . UI ;
13
13
using UnityExplorer . UI . Reusable ;
14
14
using UnityExplorer . UI . Main . CSConsole ;
15
+ using UnityExplorer . Core ;
15
16
16
17
namespace UnityExplorer . UI . Main
17
18
{
@@ -40,13 +41,12 @@ public class CSharpConsole : BaseMenuPage
40
41
#endif
41
42
} ;
42
43
43
- public override void Init ( )
44
+ public override bool Init ( )
44
45
{
45
46
Instance = this ;
46
47
47
48
try
48
49
{
49
- //m_codeEditor = new UI.CSConsole.CSharpConsole();
50
50
InitConsole ( ) ;
51
51
52
52
AutoCompleter . Init ( ) ;
@@ -57,14 +57,21 @@ public override void Init()
57
57
m_evaluator . Compile ( "" ) ;
58
58
59
59
foreach ( string use in DefaultUsing )
60
- {
61
60
AddUsing ( use ) ;
62
- }
61
+
62
+ return true ;
63
63
}
64
64
catch ( Exception e )
65
65
{
66
- ExplorerCore . LogWarning ( $ "Error setting up console!\r \n Message: { e . Message } ") ;
67
- MainMenu . Instance . Pages . RemoveAll ( it => it is CSharpConsole ) ;
66
+ string info = "The C# Console has been disabled because" ;
67
+ if ( e is NotSupportedException && e . TargetSite ? . Name == "DefineDynamicAssembly" )
68
+ info += " Reflection.Emit is not supported." ;
69
+ else
70
+ info += $ " of an unknown error.\r \n ({ e . ReflectionExToString ( ) } )";
71
+
72
+ ExplorerCore . LogWarning ( info ) ;
73
+
74
+ return false ;
68
75
}
69
76
}
70
77
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public class HomePage : BaseMenuPage
13
13
14
14
public static HomePage Instance { get ; internal set ; }
15
15
16
- public override void Init ( )
16
+ public override bool Init ( )
17
17
{
18
18
Instance = this ;
19
19
@@ -24,6 +24,8 @@ public override void Init()
24
24
new InspectorManager ( ) ;
25
25
26
26
SceneExplorer . Instance . Init ( ) ;
27
+
28
+ return true ;
27
29
}
28
30
29
31
public override void Update ( )
Original file line number Diff line number Diff line change @@ -49,10 +49,19 @@ public MainMenu()
49
49
for ( int i = 0 ; i < Pages . Count ; i ++ )
50
50
{
51
51
var page = Pages [ i ] ;
52
- page . Init ( ) ;
53
-
54
- if ( ! Pages . Contains ( page ) )
52
+
53
+ if ( ! page . Init ( ) )
54
+ {
55
+ // page init failed.
56
+ Pages . RemoveAt ( i ) ;
55
57
i -- ;
58
+
59
+ if ( page . RefNavbarButton )
60
+ page . RefNavbarButton . interactable = false ;
61
+
62
+ if ( page . Content )
63
+ GameObject . Destroy ( page . Content ) ;
64
+ }
56
65
}
57
66
58
67
// hide menu until each page has init layout (bit of a hack)
Original file line number Diff line number Diff line change @@ -18,9 +18,11 @@ public class OptionsPage : BaseMenuPage
18
18
private InputField m_defaultOutputInput ;
19
19
private Toggle m_hideOnStartupToggle ;
20
20
21
- public override void Init ( )
21
+ public override bool Init ( )
22
22
{
23
23
ConstructUI ( ) ;
24
+
25
+ return true ;
24
26
}
25
27
26
28
public override void Update ( )
Original file line number Diff line number Diff line change @@ -55,9 +55,11 @@ public SearchPage()
55
55
Instance = this ;
56
56
}
57
57
58
- public override void Init ( )
58
+ public override bool Init ( )
59
59
{
60
60
ConstructUI ( ) ;
61
+
62
+ return true ;
61
63
}
62
64
63
65
public void OnSceneChange ( )
You can’t perform that action at this time.
0 commit comments