简体   繁体   English

Unity SyncVar字符串太长?

[英]Unity SyncVar string too long?

It seems there is a hard limit to the size of a string I would like to sync. 我想同步的字符串大小似乎受到严格限制。 I'm programmatically creating a Mesh on the server and then using MeshSerializer2 to turn it into a string. 我正在以编程方式在服务器上创建一个Mesh ,然后使用MeshSerializer2将其转换为字符串。 I would like to sync this string over the networks and user MeshSerializer2 on the client to create the mesh . 我想通过网络和客户端上的用户MeshSerializer2同步此字符串以创建mesh

I'm getting error when I run the code. 运行代码时出现错误。

IndexOutOfRangeException: Serialize(string) too long: 280416 IndexOutOfRangeException:序列化(string)太长:280416

Any idea how to sync a Mesh over UNET? 知道如何通过UNET同步Mesh吗?

The serializer returns a byte array. 串行器返回一个字节数组。 Cut that array in smaller pieces and reconstruct the array on the receiving end. 将阵列切成小块,然后在接收端重建阵列。 The sending method also passes an order ID so you can reconstruct in order on the other side. 发送方法还传递了订单ID,因此您可以在另一侧按顺序进行重构。

Here it is : http://answers.unity3d.com/questions/1113376/unet-send-big-amount-of-data-over-network-how-to-s.html 它是: http : //answers.unity3d.com/questions/1113376/unet-send-big-amount-of-data-over-network-how-to-s.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM