com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Best way to represent strings in NetworkVariables in pre8+

Open ezoray opened this issue 2 years ago • 3 comments

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>>();

ezoray avatar Apr 29 '22 16:04 ezoray

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

Stealcase avatar May 01 '22 15:05 Stealcase

@ashwinimurt , can you see if this is in our backlog?

will-mearns avatar May 03 '22 16:05 will-mearns

https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/1961

qkdreyer avatar May 14 '22 12:05 qkdreyer

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

ShadauxCat avatar Apr 25 '23 18:04 ShadauxCat