I have this code:
private void PopulateServerEntities()
{
var globals = FindObjectOfType<GlobalAssets>();
var npc = Instantiate<GameObject>(globals.NetworkEntityStatePrototype);
var chest = Instantiate<GameObject>(globals.NetworkEntityStatePrototype);
npc.GetComponent<NetworkEntityState>().PrefabType = PrefabType.Npc;
chest.GetComponent<NetworkEntityState>().PrefabType = PrefabType.Chest;
NetworkServer.Spawn(npc);
NetworkServer.Spawn(chest);
}
And would like to spawn the chest object at 10, 10, 10 so I used
var chest = Instantiate<GameObject>(globals.NetworkEntityStatePrototype, new Vector3(10, 10, 10), Quaternion.identity);
But it just doesn’t work, the object is still at 0, 0, 0
Is there anything wrong with this approach?