I am using version 1.3.0-pre.2 of the Dedicated Server package in the Unity 6 preview editor. I selected a GameObject as the server for multiplayer roles, so it would be stripped in the clients. However, when I use DontDestroyOnLoad
in the Awake
method, it does not get stripped in the editor. When I move DontDestroyOnLoad
to Start
, it works as expected. [Video: streamable.com]
public class ServerManager : MonoBehaviour
{
public static ServerManager Instance { get; private set; }
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
//DontDestroyOnLoad(gameObject); // strip not work here in the editor
}
private void Start()
{
DontDestroyOnLoad(gameObject); // strip the game object work here in the editor
}
}
I tried changing the default execution order of the following script to solve this issue but I couldn’t do it.
internal class MultiplayerRolesData : Component {}
I believe this is a bug, but if not, I apologize. Have a good day.
[SS]