Skip to content

Commit 4c2ac45

Browse files
committed
fix: Fixed compilation error related to AssetDatabase.SaveAssetIfDirty() in Unity 2021.1.16 and older
1 parent fd24ea4 commit 4c2ac45

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Editor/GenericTypesAnalyzer/GenericTypesAnalyzer.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
namespace GenericUnityObjects.Editor
1+
#if UNITY_2020_3 && ! (UNITY_2020_3_0 || UNITY_2020_3_1 || UNITY_2020_3_2 || UNITY_2020_3_3 || UNITY_2020_3_4 || UNITY_2020_3_5 || UNITY_2020_3_6 || UNITY_2020_3_7 || UNITY_2020_3_8 || UNITY_2020_3_9 || UNITY_2020_3_10 || UNITY_2020_3_11 || UNITY_2020_3_12 || UNITY_2020_3_13 || UNITY_2020_3_14 || UNITY_2020_3_15)
2+
#define UNITY_2020_3_16_OR_NEWER
3+
#endif
4+
5+
#if UNITY_2021_1 && ! (UNITY_2021_1_0 || UNITY_2021_1_1 || UNITY_2021_1_2 || UNITY_2021_1_3 || UNITY_2021_1_4 || UNITY_2021_1_5 || UNITY_2021_1_6 || UNITY_2021_1_7 || UNITY_2021_1_8 || UNITY_2021_1_9 || UNITY_2021_1_10 || UNITY_2021_1_11 || UNITY_2021_1_12 || UNITY_2021_1_13 || UNITY_2021_1_14 || UNITY_2021_1_15 || UNITY_2021_1_16)
6+
#define UNITY_2021_1_17_OR_NEWER
7+
#endif
8+
9+
namespace GenericUnityObjects.Editor
210
{
311
using System;
412
using System.Diagnostics.CodeAnalysis;
@@ -166,8 +174,8 @@ private static void UpdateGeneratedAssemblies()
166174

167175
private static void FlushConfigChangesToDisk()
168176
{
169-
// AssetDatabase.SaveAssetIfDirty was added in Unity 2020.3.16
170-
#if UNITY_2020_3_OR_NEWER && ! (UNITY_2020_3_0 || UNITY_2020_3_1 || UNITY_2020_3_2 || UNITY_2020_3_3 || UNITY_2020_3_4 || UNITY_2020_3_5 || UNITY_2020_3_6 || UNITY_2020_3_7 || UNITY_2020_3_8 || UNITY_2020_3_9 || UNITY_2020_3_10 || UNITY_2020_3_11 || UNITY_2020_3_12 || UNITY_2020_3_13 || UNITY_2020_3_14 || UNITY_2020_3_15)
177+
// AssetDatabase.SaveAssetIfDirty was added in Unity 2020.3.16 and Unity 2021.1.17
178+
#if UNITY_2020_3_16_OR_NEWER || UNITY_2021_1_17_OR_NEWER || UNITY_2021_2_OR_NEWER
171179
AssetDatabase.SaveAssetIfDirty(GenerationDatabase<MonoBehaviour>.Instance);
172180
AssetDatabase.SaveAssetIfDirty(GenerationDatabase<GenericScriptableObject>.Instance);
173181
AssetDatabase.SaveAssetIfDirty(GenericTypesDatabase<MonoBehaviour>.Instance);

0 commit comments

Comments
 (0)