@@ -86,7 +86,6 @@ private static Object LoadModel (string fbxFileName)
86
86
modelGO . transform . parent = turntableGO . transform ;
87
87
}
88
88
}
89
- UnityEditor . Selection . objects = new Object [ ] { model } ;
90
89
91
90
return modelGO as Object ;
92
91
}
@@ -180,10 +179,12 @@ public static void LastSavedModel ()
180
179
// make turntable the active scene
181
180
UnityEngine . SceneManagement . SceneManager . SetActiveScene ( scene ) ;
182
181
183
- // find Scene window
184
- var sceneWindow = UnityEditor . EditorWindow . GetWindow < UnityEditor . SceneView > ( title : null , focus : true ) ;
185
- //sceneWindow.maximized = true;
186
- sceneWindow . FrameSelected ( ) ;
182
+ // maximize game window and start playing
183
+ var gameWindow = GetMainGameView ( ) ;
184
+ if ( gameWindow ) {
185
+ gameWindow . maximized = true ;
186
+ UnityEditor . EditorApplication . isPlaying = true ;
187
+ }
187
188
188
189
if ( AutoUpdateEnabled ( ) ) {
189
190
LoadLastSavedModel ( ) ;
@@ -192,6 +193,14 @@ public static void LastSavedModel ()
192
193
}
193
194
}
194
195
196
+ public static UnityEditor . EditorWindow GetMainGameView ( )
197
+ {
198
+ System . Reflection . Assembly assembly = typeof ( UnityEditor . EditorWindow ) . Assembly ;
199
+ System . Type type = assembly . GetType ( "UnityEditor.GameView" ) ;
200
+ UnityEditor . EditorWindow gameview = UnityEditor . EditorWindow . GetWindow ( type , false , null , true ) ;
201
+ return gameview ;
202
+ }
203
+
195
204
private static void SubscribeToEvents ( )
196
205
{
197
206
// ensure we only subscribe once
0 commit comments