Closed Valentineed closed 2 years ago
Since Netcode for GameObjects version 1.0.0-pre.8 you should use ForceNetworkSerializeByMemcpy(FixedString32Bytes) instead of just FixedString32Bytes. This behaviour also exist in version 1.0.0-pre.9. In future versions it can be brought back to just using FixedString. FixedString32Bytes should be transferred as a generic parameter to ForceNetworkSerializeByMemcpy.
Description
The problem is similar to https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/issues/1396
I can not serialize a FixedString32Bytes or FixedString64Bytes and if I use string is not possible to use a NetworkList because is not nullable
public struct LobbyPlayerState : INetworkSerializable, IEquatable
{
public ulong ClientId;
public FixedString32Bytes PlayerName;
public bool IsReady;
}
Additional Context
The log is: "The type 'Unity.Collections.FixedString32Bytes' cannot be used as type parameter 'T' in the generic type or method 'BufferSerializer.SerializeValue(ref T, FastBufferWriter.ForPrimitives)'. There is no boxing conversion from 'Unity.Collections.FixedString32Bytes' to 'System.IComparable'."
Expected Outcome
Next I try initialize NetworkList type of LobbyPlayerState:
private NetworkList lobbyPlayers;
Environment