Spawn is not shown for player join mid game

Hello,

I have created a spawn script for object whenever player spawn. This script works fine for player who are already in the scene. The problem happens when new player join mid session. This new player can’t see whatever object that are instantiated by players who are already in the scene.

I follow the code that was given in the documentation.

GameObject go = Instantiate(NetworkController.Instance.hostUI, NetworkController.Instance.canvasParent);
go.GetComponent<NetworkObject>().Spawn();

from my understanding, code from line 2 is enough for new player joining mid session to see whatever was instantiated in network.

Any help is greatly appreciated.
Thanks

Your code looks correct. Spawning an object should cause that object to get automatically be spawned on all later connecting clients as well. Just to be sure, this code is running on the server, right?

Hello. After some rest, I noticed that I didn’t put this code on server side. Now it’s running fine.

Thank you for your time