Author Topic: Failed to convert parameters  (Read 6416 times)

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Failed to convert parameters
« on: May 19, 2014, 02:19:51 PM »
Im trying to find this error since three days, but i cant.. :'(
Im very frustrated...

  1. failed to convert parameters
  2.   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00063] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:192
  3.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115
  4.   at TNet.UnityTools.ExecuteAll (TNet.List`1 rfcs, Byte funcID, System.Object[] parameters) [0x0006f] in D:\Unity_Projects\Project_Repo\Assets\Extern\TNet\Client\TNUnityTools.cs:113
  5.  
  6. UnityEngine.Debug:LogError(Object)
  7. TNet.UnityTools:PrintException(Exception, CachedFunc, Object[]) (at Assets/Extern/TNet/Client/TNUnityTools.cs:41)
  8. TNet.UnityTools:ExecuteAll(List`1, Byte, Object[]) (at Assets/Extern/TNet/Client/TNUnityTools.cs:120)
  9. TNObject:Execute(Byte, Object[]) (at Assets/Extern/TNet/Client/TNObject.cs:320)
  10. TNObject:Start() (at Assets/Extern/TNet/Client/TNObject.cs:267)

Can you give me some tips, how to find the error?
It happens only, if a player is ingame, and i try to join with the Unity Editor.

Two builded players can join, but i think they get the same error, but i can't see any errors ingame.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Failed to convert parameters
« Reply #1 on: May 19, 2014, 06:03:17 PM »
You can find the error log in the YourGame_Data folder (output.txt I think or something similar) -- assuming you built stand-alone.

That's an odd message... there should be more info than that -- the function that called it, which parameters it expects... Is this with the latest version?

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: Failed to convert parameters
« Reply #2 on: May 20, 2014, 02:31:56 AM »
Ok thanks, yes this is with the latest version.
I have no more information, than this.

And when i got this error in the Unity Editor, and if i press the Play button (Game paused on Error), after this i can play.
I got this error three times, when i join a game.

But what i noticed is, after i import the Realistic FPS Prefab
(The Realistic FPS Prefab is not synced, yet), i got this error, but if i disable all scripts, the error is still there.
« Last Edit: May 20, 2014, 02:44:08 AM by Rexima »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Failed to convert parameters
« Reply #3 on: May 20, 2014, 04:02:58 PM »
I've tracked down the issue with the non-descriptive error messages. It seems I've been to liberal at trimming some code. My fault. Use these files instead (they go into TNet/Client).

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: Failed to convert parameters
« Reply #4 on: May 24, 2014, 05:11:24 AM »
Thank you very much, this helps me a lot :)

I have a question to my problem.

If i send short's, can i receive it?

Because if i create a Debug Log, the variables are zero, so i think i can't receive shorts, right?

And i tried to send them like normal int's and convert it back to int16, but i got an exception out of array, hm any solution?
« Last Edit: May 24, 2014, 02:45:13 PM by Rexima »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Failed to convert parameters
« Reply #5 on: May 24, 2014, 04:22:54 PM »
Hmm... I think I missed shorts on the serializer's list. You can add it to TNSerializer. Search for 'double' and append it right after in all cases of its usage, like so for line 534:
  1. if (type == typeof(short)) return 16;
Don't forget to add it to the ReadObject() function as well after:
  1. case 16: return reader.ReadInt16();

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: Failed to convert parameters
« Reply #6 on: May 25, 2014, 11:50:36 AM »
Yep, that was missing, thank you very much.

But i have stillt the same problem, can you help me maybe?

Im using the TNAutoSerializer from tylerglaiel.

I attached the script, where i synchronize the Voice.

Error Message:
  1. Failed to call RFC #255 on TNAutoSerializer: failed to convert parameters
  2.   Expected args: System.Byte[]
  3.   Received args: System.Boolean
  4.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Failed to convert parameters
« Reply #7 on: May 25, 2014, 08:23:08 PM »
Yeah... I can't help much with third-party scripts here. I can only help with the functionality I created. You should use RFC functions like everywhere else in TNet. It's quite simple: tno.Send("FunctionName", Target.All, what to send);

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
Re: Failed to convert parameters
« Reply #8 on: May 26, 2014, 04:09:27 AM »
Ok i understand it.

I tried to convert the Unity's Serialization to TNet's RFC's but i can't get it working :(
The packages arrives with a huge delay.

Can you give me an example how to translate this serialization to an RFC Function?

Here is the Voice Chat Asset, what i try to convert: GitHub Link

//Edit:
With my attached RFC sync script i got errors and the voice doesnt get correctly synched.
I think i need to send an rfc in the for loop, like the unity networking script, but how? Aren't this to much packages?
And my RFC Sync script is attached.
« Last Edit: May 26, 2014, 10:28:12 AM by Rexima »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Failed to convert parameters
« Reply #9 on: May 27, 2014, 12:09:31 AM »
I wouldn't do WaitForSeconds(1f / updatesPerSecond). I'd send whatever packets are there every update. Either way you are going to be sending the same amount of data, same number of packets. Not much point in sending it in batches.

Your actual tno.Send seems a bit off to me. Why send the number of packets? You are sending packets one at a time, not all at once. So why are you trying to iterate through them inside your Syncer function? All you need to do is
  1. tno.SendQuickly("Syncer", Target.Others, packet);
...and change your Syncer function to be:
  1. [RFC] void Syncer (VoiceChatPacket packet)
...this assumes that "VoiceChatPacket" was marked with the "System.Serializable" attribute.