Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: xandeck on May 18, 2016, 09:30:55 AM

Title: TNet 3 - Suggestion or Explanation
Post by: xandeck on May 18, 2016, 09:30:55 AM
Hello Aren,

From time to time I have some problems in my code (which is really normal for programmers).
But using TNet, strangely, the Unity debug returns me errors as it were in your TNet (but it is not).
In example: I have an array like

  1. int[] myArray = new int[3];
  2.  

If I send a tno.Send to someone that still has not this array initiated, instead of Unity showing a problem in my code, it shows as TNet error, like the one below:

  1. [TNet] Failed to call TNO #16777190 function _SoldierPlayerController._NetReceive_ConfigCharacter
  2.  

But it is actually not a problem related to TNet itself. It was something that I forgot to initiate in one of my arrays (a line that came right next to receive the RFC command, in same function).
Is there any way that we can improve this or anything I can do on my side?
Thank you
Title: Re: TNet 3 - Suggestion or Explanation
Post by: cmifwdll on May 21, 2016, 04:10:51 PM
TNet wraps execution of RFCs in a try-catch block. You can see this (in TNet2 at least, probably the same in TNet3) in TNUnityTools.cs @ ExecuteAll(...) function.

When an exception occurs, it's caught by that block and printed out accordingly. This is why it'll always show as a "TNet error", even though TNet is just reporting the error. TNet does report the actual exception, along with the stack trace, you just have to scroll down a bit.

If you'd like to change this behaviour just modify the PrintException(...) function in TNUnityTools.cs, or remove the try-catch block in ExecuteAll(...) if you'd like to handle exceptions yourself (not recommended).
Title: Re: TNet 3 - Suggestion or Explanation
Post by: ArenMook on May 21, 2016, 10:19:50 PM
What cmifwdll said. :)

The only correction is that in TNet 3, execution happens in the TNObject.Execute function, line 472. The methods are all cached for best performance.