Author Topic: [Solved] Problem : Exception has been thrown by the target of an invocation.  (Read 2272 times)

zlix12

  • Guest
I seem to get this error with only one RFC and only Client side, this is odd also because the RFC is only called if the player is hosting.

  1. [TNet.RFC]
  2.         public void SendObjectInformation (uint netID)
  3.         {
  4.                 if (netID == netObject.uid)
  5.                 {
  6.                         gameManager.SaveNetObjectInfo ((int) netID, transform.position);
  7.                 }
  8.         }
  9.        
  10.         public IEnumerator Interval ()
  11.         {
  12.                 canUpdate = false;
  13.                
  14.                 if (TNManager.isHosting && netObject != null)
  15.                 {
  16.                         netObject.Send ("SendObjectInformation", TNet.Target.AllSaved, netObject.uid);
  17.                 }
  18.                
  19.                 yield return new WaitForSeconds (0.2f);
  20.                
  21.                 canUpdate = true;
  22.         }
  23.  

Any help would be much appreciated.
« Last Edit: July 04, 2013, 06:06:37 PM by zlix12 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem : Exception has been thrown by the target of an invocation.
« Reply #1 on: July 04, 2013, 04:57:07 PM »
Delete "server.dat" file. In the future, when creating a channel make sure to not choose the "persistent" option, as it will cause all your RFCs to be saved (thus creating a persistent environment). It's great for games as it allows you to implement trivial "saved game state", but terrible for development as if you change the function definition, you'll start getting exceptions like that.

zlix12

  • Guest
Re: Problem : Exception has been thrown by the target of an invocation.
« Reply #2 on: July 04, 2013, 06:05:56 PM »
Great that seems to have solved it, thank you for the quick response!