Closed
Description
Description
When a client joins a server the initial synchronized positions of Network Transform
s are wrong, if
- "In Local Space" of the
Network Transform
is off, - The
Network Transform
has a parent withoutNetwork Object
, and - The parent has a non-zero position.
The problematic code path I was able to determine:
- The
Network Object
setsm_CachedWorldPositionStays
tofalse
because it has a parent withoutNetwork Object
: - When joining the server side
Network Transform
synchronizes the local position based on that (but doesn't setnetworkState.InLocalSpace
): - The client
Network Transform
applies the transmitted position based onnewState.InLocalSpace
(which is false):
Reproduce Steps
- Create an empty called "parent"
- Set the local position of "parent" to [1, 1, 1]
- Add a cube as a child of "parent"
- Add
Network Object
andNetwork Transform
Scripts to the cube - Start the server and have a client join it (joining a host also works, but the issue doesn't happen on the host itself)
Actual Outcome
The cube on the client spawns at the origin (local position [-1, -1, -1])
Expected Outcome
The cube on the client spawns at the server position of [1, 1, 1] (local position [0, 0, 0])
Environment
- OS: Windows 10 (22H2)
- Unity Version: 2022.3.7f1
- Netcode Version: 1.9.0 (also happens on lastest release 1.8.1)
- Netcode Commit: d97d968