Search Issue Tracker
UNITY_SERVER scripting define does not work when switching to Dedicated Server from Windows by script
How to reproduce:
1. Open attached project "ServerBuildScriptingDefine.zip" and scene "SampleScene"
2. In Build Settings window, switch to Windows, Mac, Linux platform.
3. In Editor Menu, click Bug -> Repro
4. After the build completes, observe Dedicated Server build's logs
Expected result: "It's a server!" messages are logged
Actual result: "It's a server!" messages are not logged
Reproducible with: 2021.2.0b5, 2022.1.0a4
Could not test with: 2019.4.29f1, 2020.3.15f1, 2021.1.16f1 (Dedicated Server functionality not implemented)
Issue does not reproduce when the platform is set to Dedicated Server prior to executing the script.
Issue is not restricted to dedicated server builds. Any time a call to BuildPipeline.BuildPlayer builds a player which platform and subtarget does not match the current active platform in the editor the issue will manifest itself. When platform is manually switched in the Editor's BuildPlayerWindow the problem does not occur because the editor window can detect when there's a mismatch and wait for scripts to be reloaded/recompiled with the new platform compiler macros to start the build. A temporary workaround for users relying on BuildPipeline.BuildPlayer would be to trigger the build a second time if unsure of what was the current active build platform or a reload scripts dialog appears right after the build is completed without the user changing anything.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Realtime direct lighting is missing on dynamic objects under when using Shadowmask or Subtractive lighting mode(s)
- [Device Simulator] When simulator window is narrow, toolbar controls deform and some become inacessible
- Missing Lights when using Enlighten Realtime GI in HDRP
- .NETStandard 2.1 in the editor is missing System.Memory, System.Buffers at runtime
- [iOS] Multi Line Mobile Input Fields show transparent background when Dark Mode is enabled and no text is in the field