Fixed deprecated EditorSceneManager warnings on 2022.2+

This commit is contained in:
yasirkula
2023-08-31 07:10:51 +03:00
parent 1a2eba24bd
commit 3c4292159a
5 changed files with 16 additions and 11 deletions
@@ -289,10 +289,10 @@ namespace AssetUsageDetectorNamespace
if( ( searchParameters.searchInScenes & SceneSearchMode.OpenScenes ) == SceneSearchMode.OpenScenes )
{
// Get all open (and loaded) scenes
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
for( int i = 0; i < SceneManager.sceneCount; i++ )
{
Scene scene = EditorSceneManager.GetSceneAt( i );
if( scene.IsValid() )
Scene scene = SceneManager.GetSceneAt( i );
if( scene.IsValid() && scene.isLoaded )
scenesToSearch.Add( scene.path );
}
}
@@ -314,10 +314,10 @@ namespace AssetUsageDetectorNamespace
if( isInPlayMode )
{
HashSet<string> openScenes = new HashSet<string>();
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
for( int i = 0; i < SceneManager.sceneCount; i++ )
{
Scene scene = EditorSceneManager.GetSceneAt( i );
if( scene.IsValid() )
Scene scene = SceneManager.GetSceneAt( i );
if( scene.IsValid() && scene.isLoaded )
openScenes.Add( scene.path );
}
@@ -803,7 +803,12 @@ namespace AssetUsageDetectorNamespace
}
}
if( Type == GroupType.Scene && !EditorApplication.isPlaying && EditorSceneManager.loadedSceneCount > 1 )
#if UNITY_2022_2_OR_NEWER
int loadedSceneCount = SceneManager.loadedSceneCount;
#else
int loadedSceneCount = EditorSceneManager.loadedSceneCount;
#endif
if( Type == GroupType.Scene && !EditorApplication.isPlaying && loadedSceneCount > 1 )
{
// Show context menu when SearchResultGroup's header is right clicked
Scene scene = EditorSceneManager.GetSceneByPath( ScenePath );
@@ -416,9 +416,9 @@ namespace AssetUsageDetectorNamespace
// Check if all open scenes are saved (not dirty)
public static bool AreScenesSaved()
{
for( int i = 0; i < EditorSceneManager.loadedSceneCount; i++ )
for( int i = 0; i < SceneManager.sceneCount; i++ )
{
Scene scene = EditorSceneManager.GetSceneAt( i );
Scene scene = SceneManager.GetSceneAt( i );
if( scene.isDirty || string.IsNullOrEmpty( scene.path ) )
return false;
}
+1 -1
View File
@@ -1,4 +1,4 @@
= Asset Usage Detector (v2.4.1) =
= Asset Usage Detector (v2.4.2) =
Online documentation available at: https://github.com/yasirkula/UnityAssetUsageDetector
E-mail: yasirkula@gmail.com
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.assetusagedetector",
"displayName": "Asset Usage Detector",
"version": "2.4.1",
"version": "2.4.2",
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",