1

If the index is greater than 128 then we get "IndexOutOfRange Exception" in unity.

using (RTData data = RTData.Get())
  {
      data.SetVector3(129, v); // Exception here
      data.SetString(129, "Checking");   // Exception here
      gameSparksRTUnity.SendData(4, GameSparksRT.DeliveryIntent.RELIABLE, data);
}

Is there no way to send vector3 or string with a index greater than 128 ? Or am I doing something wrong.

Programmer
  • 121,791
  • 22
  • 236
  • 328
Sameer Hussain
  • 2,421
  • 8
  • 23
  • 41

1 Answers1

1

Is there no way to send vector3 or string with a index greater than 128 ? Or am I doing something wrong

No and you are not doing anything wrong. This is a limitations imposed by Gamesparks.

When RTData.SetVector3 or similar function is called, it invokes the RTData.SetRTVector function which sets a local array variable named data.

This is how that array variable is declared:

internal RTVal[] data = new RTVal[0x80];

0x80 converted to decimal is 128 so you can only use values between 0 and 127 just like you would in any array in C#.

Programmer
  • 121,791
  • 22
  • 236
  • 328
  • Thanks. So there is no way I can send more than 128 vectors in one go. Seemed a long shot anyway. – Sameer Hussain Jun 06 '18 at 16:33
  • Nope. That thing is hard-coded right there. Maybe there is a reason they chose 128. I don't know but you can't. By the way, I think that `0` to `128` is enough. If not enough then use json to serialize array of `Vector3` then send with `SetString`. – Programmer Jun 06 '18 at 21:48
  • 1
    yep that's what I was doing initially. But it takes away too many bytes... anyways thanks for all the help – Sameer Hussain Jun 07 '18 at 07:43