About Dedicated Server package
The Dedicated Server package contains optimizations and workflow improvements for developing Dedicated Server platform. For example, you can use Dedicated Server package to mark all render components of a scene so they are present only on the Standalone builds and removed in the Dedicated Server ones.
Note: This experimental package is under active development, it is meant to be used with the purpose of workflow testing and providing feedback.
Installation
To install this package, follow the instructions in the Package Manager documentation.
Requirements
This version of Dedicated Server is compatible with the following versions of the Unity Editor:
- 2023.3 and later
- Dedicated Server Build Support module installed.
Known Limitations
Dedicated Server package includes the following known limitations in its experimental version:
- When using the Entities package, the Game Objects and Components selection will not affect the entities and components baking of subscenes.
Using Dedicated Server package
CLI Arguments defaults
The Dedicated Server package allows to set default values for the CLI arguments used to launch the game server. The default values can be set in the Build Settings window for the Dedicated Server platform.
Multiplayer Roles and Content Selection
The Dedicated Server package introduces the concept of Multiplayer Role which describes the different roles that a Unity application can have in a multiplayer game. For example, a game can have a Client role and a Server role. The Client role is the one that is used by the players to play the game. The Server role is the one that is used to host the game.
In your multiplayer project, you can define which Game Objects and Components should be present/removed in the different multiplayer roles. When building or entering play mode, Unity will automatically strip the corresponding Game Objects and Components.
To enable the feature go to the Project Settings window, select the Multiplayer settings section and enable the Multiplayer Content Selection option.
When Content Selection is enabled, a new dropdown will appear in the toolbar of the Editor. This dropdown allows to select the multiplayer role to be used when building or entering play mode.
Game Objects selection from scenes.
Allows to select which Game Objects should be present/removed in the different multiplayer roles. When building or entering play mode, Unity will automatically strip the corresponding Game Objects (and all its children).
Workflow
- Open a scene.
- In the hierarchy window, select one or more Game Objects.
- In the inspector window, find the "Multiplayer Role" field and enable or disable the options: Client, Server.
Components selection from scenes
Allows to select which specific Components should be present/removed from its Game Object in the different multiplayer roles. When building or entering play mode, Unity will automatically strip the corresponding Components.
Workflow
- Open a scene.
- In the Hierarchy window, select one or more Game Objects.
- In the Inspector window, in the component section, find the "Multiplayer Role" field and enable or disable the options: Client, Server.
Selection from the Search Window
Allows to select multiple GameObjects of Components given a search criteria.
Workflow
- Open a scene.
- Open the Search Window
- Search for the objects to select (e.g. all renderers
t: Renderer
) - Select the objects
- In the Preview Inspector panel, find the "Multiplayer Role" field and enable or disable the options: Client, Server.
Prefab Assets and Instances
- Similar to Game Objects above, with one difference:
- To modify a base Prefab Asset, either select the Prefab Asset within the Project window, or select a Prefab Instance within the Hierarchy Window and click 'Open'.
- To modify a Prefab Instance, which is the actual GameObject in the scene, select the Prefab Instance within the Hierarchy window. The changes here will take precedence over those in the base Prefab Asset.
Automatic Components selection
Allows to select which specific Components should be present/removed from the project scenes and prefabs in the different multiplayer roles. When building or entering play mode, Unity will automatically strip the corresponding Components including its subclasses.
The list of components striped by the options is the following.
- Strip Rendering Components:
Camera
component.Light
component.- All components inheriting from
Render
.
- Strip UI Components:
- All components in
UnityEngine.UI
namespace. - All components in
UnityEngine.EventSystems
namespace. UnityEngine.UIElements.PanelEventHandler
component.UnityEngine.UIElements.PanelRaycaster
component.
- All components in
Strip Audio Components:
UnityEngine.AudioSource
component.UnityEngine.AudioLowPassFilter
component.UnityEngine.AudioHighPassFilter
component.UnityEngine.AudioReverbFilter
component.UnityEngine.AudioListener
component.UnityEngine.AudioReverbZone
component.UnityEngine.AudioDistortionFilter
component.UnityEngine.AudioEchoFilter
component.UnityEngine.AudioChorusFilter
component. #### Workflow
In the Project Settings window, select the Multiplayer settings
- In the Content Selection section, add the list of components to be selected for the Server or Clients.