Author Topic: Objects that are not instantiated via TNManager.Create must have a non-zero ID.  (Read 3969 times)

Bug5532

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Hi,
I'm getting this message when I play my game offline. I get it whenever I instantiate an object using TNManager.Create but am not connected. This didn't use to happen?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Hmm. Change the TNObject's Start() function to this:
  1.         void Start ()
  2.         {
  3.                 if (TNManager.isConnected)
  4.                 {
  5.                         if (id == 0)
  6.                         {
  7.                                 mParent = FindParent(transform.parent);
  8.  
  9.                                 if (mParent == null && Application.isPlaying)
  10.                                 {
  11.                                         Debug.LogError("Objects that are not instantiated via TNManager.Create must have a non-zero ID.", this);
  12.                                         return;
  13.                                 }
  14.                         }
  15.                         else
  16.                         {
  17.                                 Register();
  18.  
  19.                                 // Have there been any delayed function calls for this object? If so, execute them now.
  20.                                 for (int i = 0; i < mDelayed.size; )
  21.                                 {
  22.                                         DelayedCall dc = mDelayed[i];
  23.  
  24.                                         if (dc.objID == uid)
  25.                                         {
  26.                                                 if (!string.IsNullOrEmpty(dc.funcName)) Execute(dc.funcName, dc.parameters);
  27.                                                 else Execute(dc.funcID, dc.parameters);
  28.                                                 mDelayed.RemoveAt(i);
  29.                                                 continue;
  30.                                         }
  31.                                         ++i;
  32.                                 }
  33.                         }
  34.                 }
  35.         }

Bug5532

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 12
    • View Profile
Nice simple fix, thanks ArenMook :)