File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Assets/Editor Toolbox/Editor/Utilities Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 2
2
using System . Linq ;
3
3
4
4
using UnityEditor ;
5
+ using UnityEditor . Build ;
5
6
6
7
namespace Toolbox . Editor
7
8
{
8
9
public static class ScriptingUtility
9
10
{
10
11
public static List < string > GetDefines ( )
11
12
{
13
+ #if UNITY_2023_1_OR_NEWER
14
+ var target = NamedBuildTarget . FromBuildTargetGroup ( EditorUserBuildSettings . selectedBuildTargetGroup ) ;
15
+ var defines = PlayerSettings . GetScriptingDefineSymbols ( target ) ;
16
+ #else
12
17
var defines = PlayerSettings . GetScriptingDefineSymbolsForGroup ( EditorUserBuildSettings . selectedBuildTargetGroup ) ;
18
+ #endif
13
19
return defines . Split ( ';' ) . ToList ( ) ;
14
20
}
15
21
16
22
public static void SetDefines ( List < string > definesList )
17
23
{
18
24
var defines = string . Join ( ";" , definesList . ToArray ( ) ) ;
25
+ #if UNITY_2023_1_OR_NEWER
26
+ var target = NamedBuildTarget . FromBuildTargetGroup ( EditorUserBuildSettings . selectedBuildTargetGroup ) ;
27
+ PlayerSettings . SetScriptingDefineSymbols ( target , defines ) ;
28
+ #else
19
29
PlayerSettings . SetScriptingDefineSymbolsForGroup ( EditorUserBuildSettings . selectedBuildTargetGroup , defines ) ;
30
+ #endif
20
31
}
21
32
22
33
public static void AppendDefine ( string define )
You can’t perform that action at this time.
0 commit comments