Last year, we shared our goals for 2021. Three of our key focus areas have been improving workflows and usability, improving performance and iteration speed, and focusing on multiplayer networking. As a part of this, we’ve developed a new way to allow developers to create Unity dedicated server builds regardless of the netcode you choose to use for your application.
What is Dedicated Server target?
Our new Dedicated Server is a desktop sub-target that improves server build efficiency by automatically stripping assets and code that are not necessary for server builds each time a project is built, providing increased space and processing efficiency. As a result, Dedicated Server builds also make it more economically beneficial for server operators to run these more-efficient server applications created with Unity.
Why did Unity create a Dedicated Server target?
Traditional Unity headless server builds often contain assets and compiled code which are not accessed by headless server processes. This might include artifacts such as audio files, textures, meshes, and shaders. In a multiplayer context, rendering and asset management processes occur unnecessarily when server runtimes are being built and executed. This even happens with traditional headless Unity servers since the rendering operations are still executed, though to a null-display target. When doing builds with all this additional overhead, longer build times occur and iteration speed suffers, too.
How do I use this new feature?
Starting in Unity 2021.2, when setting your platform target, you now have the ability to specify Dedicated Server as a target type with an option to choose for which Desktop platform. This not only makes it more clear what kind of build you are creating, but also allows Unity to know to apply these optimizations during the build process. Another advantage is you get to programmatically query if the target is set to Dedicated Server in order to program Dedicated-Server-specific behaviors.
How can I access this new feature?
Dedicated Server platform support is now available inside the Unity Editor as of Unity 2021.2.0b1. Before 2021.3 LTS, Unity will move the feature from the default Unity Editor installation and into a separate support installer via Unity Hub in a future release.
What feedback is Unity looking for?
We’ve reached the stage in our development where we’d like to get your feedback on this new functionality and how it performs when tested on real game projects. These changes are focused on the way we build dedicated server projects and the final content it is packed in it, therefore the types of feedback we’re looking for are:
-
Data statistics on the projects you build with this version versus the results from build with previous versions of Unity. More specifically:
-
Project size on disk
-
Memory usage
-
CPU usage
-
Build time
-
How this new Dedicated Server target feature impacts your workflow and iteration times
-
If changes made by the Dedicated Server target could break or conflict with any previous approaches or features of your project
We welcome your feedback on ways we can improve this tool in the future, too! Please feel free to reply with feedback on the features that you would like to see in upcoming versions. If you would like to share your experience or provide any feedback or suggestions for us, please leave us a comment in this thread.
What about bug reporting?
Ideally we’d like any bugs reported through the built in bug reporter tool, as that will automatically provide us with some relevant context. For instructions on how to file bugs through the Unity editor, please go here.
Once you have submitted a bug report through the bug reporter, please feel free to refer us to it in your replies or new posts.
Changelog
-
[UI] Dedicated Server target is now listed in the Build Settings window.
-
[Memory Optimization] Pixel data for textures that are not marked as read/write is not included in Server builds.
-
[Memory Optimization] Vertex data for meshes that are not marked as read/write and not used for internal systems, is not included in Server builds.
-
[CPU Optimization] Audio system disabled in Server builds.
-
[Scripting] UNITY_SERVER defined for Assemblies in Server builds.
Currently Known issues
- Error message “shader is not supported on this GPU” in Server Builds