-
Notifications
You must be signed in to change notification settings - Fork 461
Closed
Labels
priority:highThis issue has high priority and we are focusing to resolve itThis issue has high priority and we are focusing to resolve itregressionThe issue is a regression (something that was working in previous version)The issue is a regression (something that was working in previous version)stat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:bugBug ReportBug Report
Description
Description
NetworkList doesn't synchronize initial values, when write permission is set to owner and values are added in OnNetworkSpawn.
Reproduce Steps
- Add the following script to your player owned prefab
- Host a game
- Connect an additional client to the host
- Check inspector on both host and client to see that the list values are missing on the Host, but available on the client.
Actual Outcome
Client set list values in OnNetworkSpawn are not synced to host.
Expected Outcome
List is synced with host.
Screenshots
public class Foo : NetworkBehaviour
{
public NetworkList<int> integers;
private void Awake()
{
integers = new NetworkList<int>(null, NetworkVariableReadPermission.Everyone, NetworkVariableWritePermission.Owner);
}
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
if (!IsOwner)
return;
for (var i = 0; i < 4; i++)
{
integers.Add(i);
}
}
}
Environment
- OS: Windows 11
- Unity Version: 6000.0.58f2
- Netcode Version: 2.8.0
- Netcode Commit: [e.g. https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/ba418fa5b600ad9eb61fab0575f12fbecc2c6520]
- Netcode Topology: [e.g. Client-Server, Distributed Authority, etc.]
Additional Context
Updated from 2.4.4, where it worked as intended.
Metadata
Metadata
Assignees
Labels
priority:highThis issue has high priority and we are focusing to resolve itThis issue has high priority and we are focusing to resolve itregressionThe issue is a regression (something that was working in previous version)The issue is a regression (something that was working in previous version)stat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:bugBug ReportBug Report