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
6
Question by MD_Reptile · Jun 22, 2015 at 05:53 PM · errornetworkingconnection

uNet- A connection has already been set as ready. There can only be one.

I get this error when I try hosting a server using uNet's NetworkManager:

 A connection has already been set as ready. There can only be one.
 UnityEngine.Networking.NetworkManager:Update()

And I am not sure why. All I do is call StartHost() and then later call ClientScene.AddPlayer(0) to spawn a player.

Any idea why this happens?

Comment
Add comment · Show 11
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 iyakov · Jun 22, 2015 at 06:11 PM 0
Share

I got this message when call Ready() method. By fact, the connection has already been ready and you should not do it again. By some mysterious reason it was called twice in your case. Not sure if it's the reason.

avatar image MD_Reptile · Jun 22, 2015 at 07:30 PM 0
Share

That's what I thought it might be, is I'm calling ready on clients - but when I do StartHost () as the client-server I don't call Ready (), only on clients who connect later... it seems to come from just calling StartHost ()?

avatar image iyakov · Jun 22, 2015 at 08:53 PM 0
Share

Well, Network$$anonymous$$anager does it in its Update function until connection is ready and in OnClientConnect handler. In any case this error message does not seem so bad. There's the source:

       if (ClientScene.s_IsReady)
       {
         if (LogFilter.logError)
           Debug.LogError((object) "A connection has already been set as ready. There can only be one.");
         return false;
       }

avatar image MD_Reptile · Jun 22, 2015 at 09:20 PM 0
Share

I see. I wonder if doing ClientScene.AddPlayer() causes the network manager to try and set ready again?

And also I wonder if ignoring this error is fine?

avatar image iyakov · Jun 22, 2015 at 09:35 PM 1
Share

Indeed... I still cannot handle a simple application: click to spawn an object. omg... P.S. You may use dotPeek disassembler (free software from jetbrains) to investigate issues like this.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Glabrezu · Jun 29, 2015 at 12:12 AM

I had this error when I extended NetworkManager. By trying to comment out various sections, I ended up finding what was causing it. Although I don't remember exactly what it was, I suppose this method would work for you, too.

Comment
Add comment · Show 1 · 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
avatar image MD_Reptile · Jul 08, 2015 at 10:18 PM 0
Share

Your right, I ended up switching over to NetworkLobby$$anonymous$$anager, and by changing the way I handled stuff I also avoided this error message. Wish I had something more constructive to add, but if anyone else hits this problem, look into your custom network manager!

avatar image
9

Answer by DimKa_WG · Sep 21, 2015 at 12:55 PM

Hi. Think I figured out where is ClientScene.Ready() or ClientScene.AddPlayer(0) called second time.

It's OnClientSceneChanged() method. Here is documentation, read the last sentence.

You can just override method and call in it your own code without calling base method.

Comment
Add comment · Show 5 · 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
avatar image emrys90 · Jan 24, 2016 at 12:46 PM 0
Share

Thank you! This fixed it for me.

avatar image sniperisa · Sep 24, 2016 at 03:03 PM 0
Share

Worked for me, too. Thx!

avatar image Edvard-D · Apr 09, 2017 at 07:17 AM 1
Share

If you're extending NetworkLobby$$anonymous$$anager, here's the code I needed to implement to work around the error. The only change from the NetworkLobby$$anonymous$$anager source code (as of 5.6) is commenting out the call to the base class.

     public override void OnClientSceneChanged(NetworkConnection conn)
     {
         string loadedSceneName = Scene$$anonymous$$anager.GetSceneAt(0).name;
         if (loadedSceneName == lobbyScene)
         {
             if (client.isConnected)
                 CallOnClientEnterLobby();
         }
         else
         {
             CallOnClientExitLobby();
         }
 
         /// This call is commented out since it causes a unet "A connection has already been set as ready. There can only be one." error.
         /// $$anonymous$$ore info: http://answers.unity3d.com/questions/991552/unet-a-connection-has-already-been-set-as-ready-th.html
         //base.OnClientSceneChanged(conn);
         OnLobbyClientSceneChanged(conn);
     }
 
 
     void CallOnClientEnterLobby()
     {
         OnLobbyClientEnter();
         foreach (var player in lobbySlots)
         {
             if (player == null)
                 continue;
 
             player.readyToBegin = false;
             player.OnClientEnterLobby();
         }
     }
 
     void CallOnClientExitLobby()
     {
         OnLobbyClientExit();
         foreach (var player in lobbySlots)
         {
             if (player == null)
                 continue;
 
             player.OnClientExitLobby();
         }
     }
avatar image BananeDollar · Jan 31, 2018 at 12:02 PM 0
Share

Still works and still fixed it for me. Thanks !

avatar image coffiarts · Jun 03, 2018 at 12:39 PM 0
Share

@Dim$$anonymous$$a_WG:

You can just override method and call in it your own code without calling base method.

Unfortunately, I cannot confirm this. The [Documentation you've linked][1], especially the last sentence you're mentioning, seems to claim the contrary:

The default implementation of OnClientSceneChanged in the Network$$anonymous$$anager is to add a player object for the connection if no player object exists.

When I skip calling base.OnClientSceneChanged(...), no player instance will be added on my client at all, which breaks my game. Adding the base call again brings it back to work. In my understanding, this is why you can NOT skip the base method! [1]: https://docs.unity3d.com/ScriptReference/Networking.Network$$anonymous$$anager.OnClientSceneChanged.html
avatar image
1

Answer by Anisoropos · Jul 28, 2015 at 08:41 PM

For me it was the fact that a Lobby Player's

 SendReadyToBeginMessage();

triggers the Lobby Manager's

 CheckReadyToBegin();

and if all Lobby Player flags (readyToBegin) are true, it tries to start the game.

If you call this more than once before the game starts, it will fail produce the following error:

 A connection has already been set as ready. There can only be one.
  UnityEngine.Networking.NetworkManager:Update()


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

34 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A connection has already been set as ready. There can only be one. Error received from NetworkIdentity:UNetStaticUpdate 0 Answers

Trouble with LLAPI 0 Answers

The magic key to networking? 0 Answers

Networking problems 2 Answers

NetworkMatch.DropConnection not executing callback 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