File tree Expand file tree Collapse file tree
Assets/Editor Toolbox/Runtime/Serialization Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33#if UNITY_EDITOR
44using UnityEditor ;
55#endif
6+ using UnityEngine . SceneManagement ;
67
78namespace Toolbox . Serialization
89{
@@ -40,37 +41,30 @@ internal static void ConfirmCache()
4041 internal static void RefreshCache ( )
4142 {
4243 cachedScenes . Clear ( ) ;
43- var buildIndex = - 1 ;
4444 foreach ( var scene in EditorBuildSettings . scenes )
4545 {
46- if ( string . IsNullOrEmpty ( scene . path ) )
46+ var path = scene . path ;
47+ if ( string . IsNullOrEmpty ( path ) )
4748 {
4849 continue ;
4950 }
5051
51- var sceneAsset = EditorGUIUtility . Load ( scene . path ) as SceneAsset ;
52+ var sceneAsset = EditorGUIUtility . Load ( path ) as SceneAsset ;
5253 if ( sceneAsset == null )
5354 {
5455 continue ;
5556 }
5657
57- var sceneIndex = InvalidSceneIndex ;
58- if ( scene . enabled )
59- {
60- buildIndex ++ ;
61- sceneIndex = buildIndex ;
62- }
63-
6458 if ( cachedScenes . ContainsKey ( sceneAsset ) )
6559 {
6660 continue ;
6761 }
6862
6963 cachedScenes . Add ( sceneAsset , new SceneData ( )
7064 {
71- BuildIndex = sceneIndex ,
65+ BuildIndex = SceneUtility . GetBuildIndexByScenePath ( path ) ,
7266 SceneName = sceneAsset . name ,
73- ScenePath = scene . path
67+ ScenePath = path
7468 } ) ;
7569 }
7670 }
You can’t perform that action at this time.
0 commit comments