mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Adding changed check to PreprocessorDefine (#1698)
* Adding changed check to PreprocessorDefine this stops ProjectSettings being marked as dirty each time the editor is opened * Update PreprocessorDefine.cs Co-authored-by: vis2k <info@noobtuts.com>
This commit is contained in:
parent
8aabb54929
commit
eec45ff8fe
@ -11,7 +11,8 @@ static class PreprocessorDefine
|
|||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
public static void AddDefineSymbols()
|
public static void AddDefineSymbols()
|
||||||
{
|
{
|
||||||
HashSet<string> defines = new HashSet<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';'))
|
string currentDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
||||||
|
HashSet<string> defines = new HashSet<string>(currentDefines.Split(';'))
|
||||||
{
|
{
|
||||||
"MIRROR",
|
"MIRROR",
|
||||||
"MIRROR_1726_OR_NEWER",
|
"MIRROR_1726_OR_NEWER",
|
||||||
@ -27,7 +28,14 @@ public static void AddDefineSymbols()
|
|||||||
"MIRROR_11_0_OR_NEWER",
|
"MIRROR_11_0_OR_NEWER",
|
||||||
"MIRROR_12_0_OR_NEWER"
|
"MIRROR_12_0_OR_NEWER"
|
||||||
};
|
};
|
||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, string.Join(";", defines));
|
|
||||||
|
// only touch PlayerSettings if we actually modified it.
|
||||||
|
// otherwise it shows up as changed in git each time.
|
||||||
|
string newDefines = string.Join(";", defines);
|
||||||
|
if (newDefines != currentDefines)
|
||||||
|
{
|
||||||
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, newDefines);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user