Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Tomi-Tukiainen · Aug 18, 2015 at 09:26 PM · networkingnetwork

UNet does not call OnServerReady on second connect from same machine

Hi, I'm developing a client-server setup with the new Unity Networking (UNet). My server process is a 64bit Linux build and during development I'm repeatedly making connections to the same server process from Unity Editor in my Mac OS-X development machine. I close the client just by stopping Play Mode in Unity Editor.

I've derived BowlingNetworkManager form UNet's NetworkManager and I've got it in the scene. Everything works nicely when I connect to the server process for the first time. BUT when I try to connect second time to the same server process from the same client machine, UNet does not call OnServerReady, and consequently Player prefab won't get instantiated for me. Only solution known to me is to restart the server process, after which I can connect from my laptop again (just once).

I've maxed out debug level in NetworkManager. Here is a server log of a successful connection. That is, the first connection during the lifetime of server process):

 ServerController::Start - starting server to address [SERVER-IP]:25100 via NetworkManager
 BowlingNetworkManager::OnStartServer - server started, registering handlers for messages...
 NetworkServer Created version Current
 RegisterHandler id:48 handler:BallStateMessageHandler
 ...(more RegisterHanlder log entries)...
 Server Listen. port: 25100
 RegisterHandlerSafe id:35 handler:OnClientReadyMessage
 ...(more RegisterHandlerSafe log entries)...
 NetworkManager StartServer port:25100
 Server event: host=0 event=ConnectEvent error=0
 Server accepted client:1
 NetworkManager:OnServerConnectInternal
 BowlingNetworkManager::OnServerConnect - client 1 connected.
 Server event: host=0 event=DataEvent error=0
 NetworkManager:OnServerReadyMessageInternal
 BowlingNetworkManager::OnServerReady - client 1 is now ready.
 Ready with no player object
 Ready with no player object
 NetworkManager:OnServerAddPlayerMessageInternal
 BowlingNetworkManager::OnServerAddPlayer - instantiating player NetworkPlayer for client connection 1.
 SetClientReady conn 1 already ready
 NetworkServer SetupLocalPlayerForConnection netID:0
 Adding new playerGameObject object netId: 0 asset ID d94e4ad262b364a3881c49f8a8a7a1b
 OnStartServer NetworkPlayer(Clone) (UnityEngine.GameObject) GUID:1
 SetLocalObjectOnServer 1 NetworkPlayer(Clone) (UnityEngine.GameObject)
 SetLocalObject 1 NetworkPlayer(Clone) (UnityEngine.GameObject)
 SpawnObject instance ID 1 asset ID d94e4ad262b364a3881c49f8a8a7a1b
 Added observer [CLIENT-IP] added for NetworkPlayer(Clone) (UnityEngine.GameObject)
 BowlingNetworkPlayer::Start - client 1 connected.
 ...(OK now my Unity Editor client has a Player and everything is great)...
 ...(A bit later I will stop Play Mode in Unity Editor and disconnect will be processed in server)...
 Server event: host=0 event=DisconnectEvent error=0
 NetworkManager:OnServerDisconnectInternal
 BowlingNetworkManager::OnServerDisconnect - client 1 disconnected.
 DestroyObject instance:1
 Server.SendToObservers id:1
 Server lost client:1

I just leave the server running and continue development a bit. Later I'll try to connect to the same server process again by hitting Play in Unity Editor but this time UNet will not call OnServerReady for my connection! Here is the log. Note how client number is 1 again... is this normal?

 Server event: host=0 event=ConnectEvent error=0
 Server accepted client:1
 NetworkManager:OnServerConnectInternal
 BowlingNetworkManager::OnServerConnect - client 1 connected.

And there it stops. These should be coming next but they never occur, unless I restart the server process.

 Server event: host=0 event=DataEvent error=0
 NetworkManager:OnServerReadyMessageInternal
 BowlingNetworkManager::OnServerReady - client 1 is now ready.
 

Any ideas? It is a shame I need to restart server process before I can reconnect... and of course a real client should be able to connect to the server process many times. ;)

Comment
Add comment · Show 2
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 Tomi-Tukiainen · Aug 19, 2015 at 08:46 AM 0
Share

I just found out that reconnecting from same client does not work because of my "Advanced Configuration" of Network$$anonymous$$anager. I have enabled advanced configuration and added one QoS channel, which is set to "State Update".

With normal configuration reconnecting work, but if you add 3rd QoS channel with State Update reliability, it won't work anymore.

avatar image Tomi-Tukiainen · Aug 19, 2015 at 09:03 AM 0
Share

Actually enabling Advanced Configuration from Network$$anonymous$$anager is enough to break reconnect from same client. You don't need to add any new Qos channels.

0 Replies

· Add your reply
  • Sort: 

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

Network rigidbody synchronize 0 Answers

Detect SinglePlayer mode in a Multiplayer game. 1 Answer

Can i make multiplayer game without unity multiplayer service ? 1 Answer

Networking: multiple childs issue 1 Answer

Server asynchronous loading of resources, the client how to synchronize? 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