com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
Best way to represent strings in NetworkVariables in pre8+
As mentioned in this thread FixedString*Bytes types can no longer be used directly as network variables. I see in the pre8 release notes the handling of structs has changed, it mentions RPC's but it seems to relate to network variables as well.
With that in mind, what's the best way to have network variables containing string types, something like this?
NetworkVariable<ForceNetworkSerializeByMemcpy<FixedString64Bytes>> playerName = new NetworkVariable<ForceNetworkSerializeByMemcpy<FixedString64Bytes>>();
For those coming here through the google/the Unity Forums thread, check out https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/1901 for details on why this changed.
Also Documented here: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/releases/tag/1.0.0-pre.8
@ashwinimurt , can you see if this is in our backlog?
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/1961
Closing this very old issue - we added fixed string support back to NetworkVariables in 1.0.0-pre.10, as @qkdreyer pointed out, in #1961