Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by hasseyg · Jun 30, 2015 at 12:30 PM · networkingnetworkserverclientmanager

ClientScene.AddPlayer resulting in 'Unknown message ID' error

Hi, I have a test Unity networking project where in the menu scene I have implemented the NetworkManager class and have disabled player auto creation. When a server starts a game using matchmaker and a client then joins that game, the server then changes the scene to the 'Game' scene. Both the server and the client successfully load this scene and the sever instantiates it's prefab and and calls NetworkServer.Spawn to show it on client. Up to this point the code and works and both the server and client can see the server's spawned object, however when I call ClientScene.AddPlayer on the client to send a message to the server to create the client's player, it results in an error on the server machine and OnServerAddPlayer is not called. The error is :

Unknown message ID 37 connId:1 UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

Has anyone else ran into this or a similar issue?

thanks

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Creeo · Jul 13, 2015 at 10:22 AM 0
Share

Same here. And if I try:

 void OnClientConnected (Network$$anonymous$$essage msg) {
         NetworkServer.AddPlayerForConnection(msg.conn, playerPrefab, 0);
         //NetworkServer.SetClientReady(msg.conn);
     }

I get:

$$anonymous$$ message ID 12 UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · Jul 13, 2015 at 10:28 AM

I think you mean to use

http://docs.unity3d.com/ScriptReference/Networking.NetworkManager.OnClientConnect.html

instead of "OnClientConnected".

The properly named function will support the message.

Also, I think you are meant to spawn the prefab first then register the spawned gameobject in the function AddPlayerForConnection.

When a SYSTEM_ADD_PLAYER message handler has received a request from a player, the server should call this when he's created the player's object.

Also, OnClientConnect is a Client side function whilst AddPlayerForConnection appears to be serverside. On a host machine you have both client and server together so that function will be accessed twice. You need to use if(isServer) if(isClient) (or !isServer etc) to only run the appropriate code on the appropriate setup.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Connect to remote private IP 1 Answer

Unity networking tutorial? 6 Answers

OnConnectedToServer not called when testing on same machine 0 Answers

Network game. Server not responding(stuck). 1 Answer

Authoritative vs Non-authoritative server (turn-based) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges