@@ -135,14 +135,27 @@ public static void LastSavedModel ()
135
135
System . Collections . Generic . List < UnityEngine . SceneManagement . Scene > scenes
136
136
= new System . Collections . Generic . List < UnityEngine . SceneManagement . Scene > ( ) ;
137
137
138
+ var desiredScene = FbxExporters . EditorTools . ExportSettings . instance . turntableScene ;
139
+ string desiredSceneName = null ;
140
+ if ( desiredScene ) {
141
+ desiredSceneName = desiredScene . name ;
142
+ }
143
+
144
+ bool foundScene = false ;
138
145
for ( int i = 0 ; i < UnityEngine . SceneManagement . SceneManager . sceneCount ; i ++ ) {
139
146
UnityEngine . SceneManagement . Scene toAdd = UnityEngine . SceneManagement . SceneManager . GetSceneAt ( i ) ;
140
147
141
148
// skip Untitled scene.
142
149
// The Untitled scene cannot be unloaded, if modified, and we don't want to force the user to save it.
143
150
if ( toAdd . name == "" ) continue ;
144
151
145
- if ( toAdd . name == SceneName )
152
+ if ( desiredSceneName != null && toAdd . name == desiredSceneName ) {
153
+ scene = toAdd ;
154
+ foundScene = true ;
155
+ continue ;
156
+ }
157
+
158
+ if ( ! foundScene && toAdd . name == SceneName )
146
159
{
147
160
scene = toAdd ;
148
161
continue ;
@@ -153,17 +166,24 @@ public static void LastSavedModel ()
153
166
// if turntable scene not added to list of scenes
154
167
if ( ! scene . IsValid ( ) )
155
168
{
156
- // and if for some reason the turntable scene is missing create an empty scene
157
- // NOTE: we cannot use NewScene because it will force me to save the modified Untitled scene
158
- if ( ! System . IO . File . Exists ( GetSceneFilePath ( ) ) )
159
- {
160
- var writer = System . IO . File . CreateText ( GetSceneFilePath ( ) ) ;
161
- writer . WriteLine ( "%YAML 1.1\n %TAG !u! tag:unity3d.com,2011:" ) ;
162
- writer . Close ( ) ;
163
- UnityEditor . AssetDatabase . Refresh ( ) ;
169
+ string scenePath = null ;
170
+ if ( desiredScene ) {
171
+ scenePath = UnityEditor . AssetDatabase . GetAssetPath ( desiredScene ) ;
172
+ Debug . LogWarning ( scenePath ) ;
173
+ } else {
174
+
175
+ // and if for some reason the turntable scene is missing create an empty scene
176
+ // NOTE: we cannot use NewScene because it will force me to save the modified Untitled scene
177
+ if ( ! System . IO . File . Exists ( GetSceneFilePath ( ) ) ) {
178
+ var writer = System . IO . File . CreateText ( GetSceneFilePath ( ) ) ;
179
+ writer . WriteLine ( "%YAML 1.1\n %TAG !u! tag:unity3d.com,2011:" ) ;
180
+ writer . Close ( ) ;
181
+ UnityEditor . AssetDatabase . Refresh ( ) ;
182
+ }
183
+ scenePath = GetSceneFilePath ( ) ;
164
184
}
165
185
166
- scene = UnityEditor . SceneManagement . EditorSceneManager . OpenScene ( GetSceneFilePath ( ) , UnityEditor . SceneManagement . OpenSceneMode . Additive ) ;
186
+ scene = UnityEditor . SceneManagement . EditorSceneManager . OpenScene ( scenePath , UnityEditor . SceneManagement . OpenSceneMode . Additive ) ;
167
187
}
168
188
169
189
// save unmodified scenes (but not the untitled or turntable scene)
0 commit comments