On the server, I want to instantiate some characters in specific positions and rotation before spawning them (with client ownership)
I’m using the ClientNetworkTransform as shown here: NetworkTransform | Unity Multiplayer Networking
private void SetupUnits(GameObject playerObject, ulong clientId)
{
...
// Select a random available spawn point
Transform transform = _level.UnitSpawnLocations.spawnLocations.GetRandomAvailable();
GameObject unit = Instantiate(_unitPrefab, transform.position, transform.rotation);
// Spawn Unit
unit.GetComponent<NetworkObject>().SpawnWithOwnership(clientId, true);
//unit.transform.parent = playerObject.transform;
...
}
}
The NetworkObject is spawned at the right position, but the rotation gets reset.
I’m not sure if it would be excpected behaviour, as once spawned only the client can write the transform, but why would the position be synched then?
Could you take an inspector view screenshot of the network prefab’s assigned (client) NetworkTransform?
Just want to see all of the settings prior to making any suggestions to resolve your issue.
Sure, here it is:

(I’m not interested in X and Z rotation)

Hmmm… this could be a bug.
Could you do the following to see if this resolves your issue?
-
Copy your Packages\manifest.json file or save the com.unity.netcode.gameobjects entry value (text file or the like)
-
replace your project’s Packages\manifest.json com.unity.netcode.gameobjects entry with this:
-
“com.unity.netcode.gameobjects”: “com.unity.netcode.gameobjects/com.unity.netcode.gameobjects at develop · Unity-Technologies/com.unity.netcode.gameobjects · GitHub”,
Let me know if the issue persists or no longer happens with the current pending v1.8.0 NGO updates?
Thanks for the suggestion but unfortunately it doesn’t seem to make a difference.
Here is a project that provides you with a recommended way to handle spawn points and assignment of position and rotation when using an owner authoritative model (i.e. client ownership). Let me know if this helps you resolve your issues with rotation not being correct upon a player spawning.
9538822–1346908–SpawnPositionAndRotation.zip (44.9 KB)