Search Issue Tracker
Fixed in 2022.1.X
Votes
0
Found in
2021.2
2021.2.0b7
2022.1
Issue ID
1358037
Regression
No
SetScriptingDefineSymbolsForGroup does not set specified symbols for script compilation when Dedicated Server Platform is used
Steps to reproduce:
1. Open users attached project
2. Press Bug>Reproduce
3. Open Edit>Project Settings>Player>Other Settings
4. Observe Scripting Define Symbols list
Expected result: 'BUG_IS_HERE' is visible in the list
Actual result: 'BUG_IS_HERE' is not visible in the list
Reproducible with: 2021.2.0a20, 2021.2.0b8, 2022.1.0a1
Not reproducible with: 2022.1.0a2, 2022.1.0a5
Could not test with: 2019.4.29f1, 2020.3.16f1, 2021.1.17f1, 2021.2.0a19 (Dedicated Server functionality not implemented)
Comments (3)
-
brinca
Dec 06, 2022 12:50
You can use PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.Server) and PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.Server, defines).
Tested in Unity 2021.3.14f1, both in editor and batch mode.
-
PyrateAkananto
Nov 23, 2022 14:52
I don't see this fixed in any version I tried (2021.3.2f1, 2021.3.14f1, 2022.1.23f).
The information that it is a dedicated server build is within StandaloneBuildSubtarget (SUB!) and neither within the BuildTarget nor the BuildTargetGroup. Therefore you cannot use SetScriptingDefineSymbolsForGroup (https://docs.unity3d.com/ScriptReference/PlayerSettings.SetScriptingDefineSymbolsForGroup.html) which uses BuildTargetGroup as parameter. Instead you have to use SetScriptingDefineSymbols (https://docs.unity3d.com/ScriptReference/PlayerSettings.SetScriptingDefineSymbols.html) which uses NamedBuildTarget. The relevant value is NamedBuildTarget.Server.
Unfortunately even the official conversion functions to NamedBuildTarget from BuildTarget (UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(BuildPipeline.GetBuildTargetGroup(buildTarget))) do ignore the StandaloneBuildSubtarget. A Unity forum thread (https://forum.unity.com/threads/unity-2021-2-get-current-namedbuildtarget.1230114/) mentions an internal conversion function which does consider the StandaloneBuildSubtarget, but that function is only internal.
-
NN_KimJongsu
Oct 18, 2022 03:15
is this issue will apply in unity 2021 lts version?
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a2