Skip to content

Commit a1b66ce

Browse files
committed
Removed pre-2021.3 compiler directives to simplify the codebase
1 parent 2bd6a02 commit a1b66ce

5 files changed

Lines changed: 2 additions & 32 deletions

File tree

Plugins/AssetUsageDetector/Editor/AssetUsageDetector.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
using System.IO;
99
using System.Text;
1010
using Object = UnityEngine.Object;
11-
#if UNITY_2018_3_OR_NEWER && !UNITY_2021_2_OR_NEWER
12-
using PrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStage;
13-
using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility;
14-
#endif
1511

1612
namespace AssetUsageDetectorNamespace
1713
{

Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ private static string ExtractGUIDFromString( string str )
181181
private readonly FieldInfoGetter fieldInfoGetter = (FieldInfoGetter) Delegate.CreateDelegate( typeof( FieldInfoGetter ), typeof( Editor ).Assembly.GetType( "UnityEditor.ScriptAttributeUtility" ).GetMethod( "GetFieldInfoAndStaticTypeFromProperty", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
182182
private readonly Func<Object> lightmapSettingsGetter = (Func<Object>) Delegate.CreateDelegate( typeof( Func<Object> ), typeof( LightmapEditorSettings ).GetMethod( "GetLightmapSettings", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
183183
private readonly Func<Object> renderSettingsGetter = (Func<Object>) Delegate.CreateDelegate( typeof( Func<Object> ), typeof( RenderSettings ).GetMethod( "GetRenderSettings", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
184-
#if UNITY_2021_2_OR_NEWER
185184
private readonly Func<Cubemap> defaultReflectionProbeGetter = (Func<Cubemap>) Delegate.CreateDelegate( typeof( Func<Cubemap> ), typeof( RenderSettings ).GetProperty( "defaultReflection", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ).GetGetMethod( true ) );
186-
#endif
187185

188186
internal static readonly Func<SpriteAtlas, Sprite[]> spriteAtlasPackedSpritesGetter = (Func<SpriteAtlas, Sprite[]>) Delegate.CreateDelegate( typeof( Func<SpriteAtlas, Sprite[]> ), typeof( SpriteAtlasExtensions ).GetMethod( "GetPackedSprites", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static ) );
189187
#if ASSET_USAGE_ADDRESSABLES
@@ -985,11 +983,7 @@ private ReferenceNode SearchRenderSettings( object obj )
985983
{
986984
ReferenceNode referenceNode = PopReferenceNode( obj );
987985

988-
#if UNITY_2021_2_OR_NEWER
989986
referenceNode.AddLinkTo( SearchObject( defaultReflectionProbeGetter() ), "Default Reflection Probe" );
990-
#else
991-
referenceNode.AddLinkTo( SearchObject( ReflectionProbe.defaultTexture ), "Default Reflection Probe" );
992-
#endif
993987
SearchVariablesWithSerializedObject( referenceNode, true );
994988
return referenceNode;
995989
}
@@ -1625,11 +1619,9 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
16251619
if( field.FieldType.IsIgnoredUnityType() )
16261620
continue;
16271621

1628-
#if UNITY_2021_2_OR_NEWER
16291622
// "ref struct"s can't be accessed via reflection
16301623
if( field.FieldType.IsByRefLike )
16311624
continue;
1632-
#endif
16331625

16341626
// Additional filtering for fields:
16351627
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
@@ -1665,11 +1657,9 @@ private VariableGetterHolder[] GetFilteredVariablesForType( Type type )
16651657
if( property.PropertyType.IsIgnoredUnityType() )
16661658
continue;
16671659

1668-
#if UNITY_2021_2_OR_NEWER
16691660
// "ref struct"s can't be accessed via reflection
16701661
if( property.PropertyType.IsByRefLike )
16711662
continue;
1672-
#endif
16731663

16741664
// Skip properties without a getter function
16751665
MethodInfo propertyGetter = property.GetGetMethod( true );

Plugins/AssetUsageDetector/Editor/AssetUsageDetectorWindow.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
using UnityEngine;
22
using UnityEditor;
3+
using UnityEditor.SceneManagement;
34
using System.Collections.Generic;
45
using System.Reflection;
56
using Object = UnityEngine.Object;
6-
#if UNITY_2021_2_OR_NEWER
7-
using PrefabStage = UnityEditor.SceneManagement.PrefabStage;
8-
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
9-
#elif UNITY_2018_3_OR_NEWER
10-
using PrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStage;
11-
using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility;
12-
#endif
137

148
namespace AssetUsageDetectorNamespace
159
{

Plugins/AssetUsageDetector/Editor/SearchResultTreeView.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
using System.Text;
55
using UnityEditor;
66
using UnityEditor.IMGUI.Controls;
7+
using UnityEditor.SceneManagement;
78
using UnityEngine;
8-
#if UNITY_2021_2_OR_NEWER
9-
using PrefabStage = UnityEditor.SceneManagement.PrefabStage;
10-
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility;
11-
#elif UNITY_2018_3_OR_NEWER
12-
using PrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStage;
13-
using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility;
14-
#endif
159

1610
namespace AssetUsageDetectorNamespace
1711
{

Plugins/AssetUsageDetector/Editor/Utilities.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
using UnityEngine;
99
using UnityEngine.SceneManagement;
1010
using Object = UnityEngine.Object;
11-
#if UNITY_2018_3_OR_NEWER && !UNITY_2021_2_OR_NEWER
12-
using PrefabStage = UnityEditor.Experimental.SceneManagement.PrefabStage;
13-
using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility;
14-
#endif
1511

1612
namespace AssetUsageDetectorNamespace
1713
{

0 commit comments

Comments
 (0)