c# - 使用gamesparks RTDataBuilder发送字符串,如果索引大于128就会出现IndexOutOfRange异常
问题描述
如果索引大于 128,那么我们统一得到“IndexOutOfRange Exception”。
using (RTData data = RTData.Get())
{
data.SetVector3(129, v); // Exception here
data.SetString(129, "Checking"); // Exception here
gameSparksRTUnity.SendData(4, GameSparksRT.DeliveryIntent.RELIABLE, data);
}
有没有办法发送索引大于 128 的 vector3 或字符串?还是我做错了什么。
解决方案
有没有办法发送索引大于 128 的 vector3 或字符串?还是我做错了什么
不,你没有做错任何事。这是 Gamesparks 施加的限制。
当RTData.SetVector3
或类似的函数被调用时,它会调用RTData.SetRTVector
设置一个名为 的局部数组变量的函数data
。
这是该数组变量的声明方式:
internal RTVal[] data = new RTVal[0x80];
0x80
转换为十进制,128
因此您只能使用介于0
和之间的值,127
就像在 C# 中的任何数组中一样。
推荐阅读
- c++ - TCP 服务器不接受客户端发出的正确数量的连接,侦听积压较少
- python - 具有多个值的熊猫系列如何正确绘制
- git - 在 Sap Web ide Full Stack 中删除 Git 项目
- jax-rs - 如何在 Meecrowave 中启用 SSE?
- python - 使用列表推导创建剥离的嵌套字符串列表
- reactjs - 我应该使用 Redux store.subscribe() 还是用 react-redux 包装我的应用程序
? - java - 命名查询执行的通用实现
- jhipster - 尝试调用微服务时 JHipster 504 网关超时
- nfc - Proxmark3 rdv4 和 Proxmark3 evo 之间的区别
- c# - 如何使用 Entity Framework 6 在 ASP.NET MVC 5 中保存自定义模型?