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 PiFLYON · Nov 30, 2016 at 10:56 AM · multiplayernetworklobbyscene change

How to leave / Exit the LobbyManager and go back to main menu ?

Hi, I think my question is clear in its title but I can tell a bit more :

  • I have a scene with a Network Lobby Manager for a 2 players versus game.

  • When 2 players join, the game start on a new scene.

  • When a player wins/loses, a scene shows the result of the game

  • Then it goes back to Lobby (I did not find anyway to start another game without going back to Lobby)

There I'm stuck : what to do to leave the LobbyManager scene and go back to a main menu (for Solo playing for example) ? I did find this to go back to lobby after Game Over :

SendReturnToLobby();

Does exist a function like say CloseLobbyManager() or ExitLobbyManagerToScene (scene) ?...

Thank You for your help.

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 Gaming-Dudester · Nov 30, 2016 at 11:11 AM 0
Share

I'm not sure i understand this. So are you just trying to leave the lobby manager and go back to the main menu?

avatar image PiFLYON Gaming-Dudester · Nov 30, 2016 at 11:26 AM 0
Share

Exact, for the player to go back to main menu and either play solo $$anonymous$$ode, or go again in versus mode, or anywhere else (credits, settings...).

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by PiFLYON · Dec 01, 2016 at 10:13 AM

It's ok, I found a way... It's "Network.Disconnect()".

 using UnityEngine;
 using System.Collections;
 using UnityEngine.Networking;
 
 
 public class VersusExitButton : MonoBehaviour {
 
     private GameObject LBM;
     void Start() {
 
         LBM = GameObject.Find ("LobbyManager");
     }
 
     void OnMouseDown () {
         Network.Disconnect ();
         Destroy (LBM);
         GameManager.gameManager.MainLoadScene ("scene00"); // SCENE SUIVANTE
     }
 
 
 }
Comment
Add comment · Show 3 · 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 WickedFreaK · Mar 30, 2017 at 08:20 AM 0
Share

If i leave the lobby like this and go back to the lobby, the lobby seems broken and does not behave normal,

avatar image PiFLYON WickedFreaK · Mar 30, 2017 at 08:35 AM 1
Share

Hi wickedFreak,

Here is the code I finally made to achieve what I wanted. I'm not sure it is the correct way (I was expecting an answer from Unity community which did not came as you can see).

Hope this will help. (In the comments "attends un peu" means "wait for a little while", it's for letting time to get things done before exiting). Put this code on any visible GameObject.

 public class VersusExitButton : $$anonymous$$onoBehaviour {
 
 
     void Start() {
 
     }
 
     void On$$anonymous$$ouseUp () {
 
 
         Network$$anonymous$$anager.singleton.StopClient ();
         Network$$anonymous$$anager.singleton.StopHost ();
 
         NetworkLobby$$anonymous$$anager.singleton.StopClient ();
         NetworkLobby$$anonymous$$anager.singleton.StopServer ();
     
         NetworkServer.DisconnectAll ();
         //Network.Disconnect ();
 
         StartCoroutine (ExitDelay());
     
     }
 
     IEnumerator ExitDelay() {
         yield return new WaitForSeconds (0.1f);//attends un peu
         Destroy(NetworkLobby$$anonymous$$anager.singleton.gameObject);
 
         yield return new WaitForSeconds (0.1f);//attends un peu
 
         Game$$anonymous$$anager.game$$anonymous$$anager.$$anonymous$$ainLoadScene ("scene00"); // SCENE SUIVANTE
 
     }
 }
avatar image WickedFreaK PiFLYON · Apr 02, 2017 at 02:19 PM 0
Share

Thanx a lot! I will try that.

avatar image
0

Answer by Dplepler · Aug 24, 2020 at 04:04 PM

I know this is a bit late but I am a newbie and I am still stuck on this error. I tried Pifloyn's answer but I don't know what the GameManager is and it seems to bring me to the lobby scene but my mouse disappears.. Does anyone know how to fix this? Thanks

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

6 People are following this question.

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

Related Questions

Cant click buttons after loading game scene using LobbyManager 2 Answers

How to get reference of the Local Game Player when a Game Scene is Loaded from a Lobby Scene [Multiplayer] 1 Answer

Authoritative Server help 1 Answer

How to check for a host in a certain area in a open world game? 0 Answers

RPC call on other scene,NetworkView RPCs in other scene, 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