I am instantiating a gameObject server-side using the code below. The problem I am facing is that the SyncVar "PlayerUnit" is null on the client, even though I referenced a networked gameObject. Anyone knows what the problem is and how to solve it? Thanks for any help!
[SyncVar]
public GameObject PlayerUnit;
public GameObject PlayerUnitPrefab;
void SpawnUnit()
{
print("Spawning Player Unit");
GameObject newPlayerUnit = Instantiate(PlayerUnitPrefab);
NetworkServer.Spawn(newPlayerUnit);
PlayerUnit = newPlayerUnit;
}