Author Topic: Unknown prefix: 41  (Read 3795 times)

benq

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 6
    • View Profile
Unknown prefix: 41
« on: December 16, 2014, 01:58:23 PM »
Hi, i've tried to not request help, but this time i don't know how to start debugging it.

What is already in Scene:
- An object with TNObject & TNSync Rigidbody (players touch it and moves, has a rigidbody component)

What is instanciated when joining the game:
- A prefab with TNObject, TNAuto Sync (for some player data) & TNSync Rigidbody (players are also a rigidbody)

This error appears after a player creates a game, when a second joins it.


  1. Unknown prefix: 41
  2. UnityEngine.Debug:LogError(Object)
  3. TNet.Serialization:ReadObject(BinaryReader, Object, Int32, Type, Boolean) (at Assets/TNet/Client/TNSerializer.cs:1411)
  4. TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Client/TNSerializer.cs:1114)
  5. BinaryExtensions:ReadArray(BinaryReader) (at Assets/TNet/Client/BinaryExtensions.cs:59)
  6. TNManager:OnForwardedPacket(BinaryReader) (at Assets/TNet/Client/TNManager.cs:1089)
  7. TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:790)
  8. TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:727)
  9. TNManager:Update() (at Assets/TNet/Client/TNManager.cs:1097)
  10.  

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unknown prefix: 41
« Reply #1 on: December 17, 2014, 03:43:45 PM »
That looks like a malformed packet. What version of TNet, and what are you sending?

benq

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Unknown prefix: 41
« Reply #2 on: December 19, 2014, 03:27:45 PM »
That looks like a malformed packet. What version of TNet, and what are you sending?

Looks like i've found it. Server starts sending packets before client has loaded the necessary scripts.. I've added a delay and now it works.

By the way, is there any onSerialize function like OnPhotonSerializeView in Photon Cloud solutions? Rigidbody syncing looks laggy without it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unknown prefix: 41
« Reply #3 on: December 19, 2014, 06:00:40 PM »
You should have everything registered before the scene load, or at least in Awake() existing in the scene when you load it.

OnPhotonSerializeView sounds the same as Unity's stream serialization. I don't know about Photon's, but Unity's was only one-directional. With TNet if you want to send frequent packets, use tno.SendQuickly (so UDP).

benq

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Unknown prefix: 41
« Reply #4 on: December 20, 2014, 04:17:46 AM »
You should have everything registered before the scene load, or at least in Awake() existing in the scene when you load it.

OnPhotonSerializeView sounds the same as Unity's stream serialization. I don't know about Photon's, but Unity's was only one-directional. With TNet if you want to send frequent packets, use tno.SendQuickly (so UDP).

It was set as you said:
  1. void Awake () {
  2.                 TNManager.AddRCCs<CURRENT_CLASS_NAME>();
  3.         }
  4.  
It works with the timeout so no problem.

I will take a look at this thread: http://www.tasharen.com/forum/index.php?topic=7667.msg36187#msg36187

Did you check the thread fix for 99% CPU bug?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Unknown prefix: 41
« Reply #5 on: December 21, 2014, 08:25:20 AM »
http://www.tasharen.com/tnet/TNServer.zip -- has the no console option by default. I've PM'd you about it too.