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
0
Question by Lionel_Leeser · Aug 16, 2017 at 07:39 PM · gameobjectnetworkingcustomlobbyfeatures

Lobby - Trouble with custom feature

Hi guys,

So I'm losing my mind on, what it seems, a basic feature...

I want to use the lobby system because it is exactly what I need, this kind "party" creation. Actually I'm only working in local.

I have integrated the Unity project that set all the basics to use the lobby system. It's working well.

Now, I try to tweak a bit the Lobby panel (where the player connects before starting the game). I want that the lobby creator (let's call it admin) will be able to select a map and all the other player just see the name of the selected map in a Text UI element.

My first tries was to create the bottom bar in the scene but I had trouble to make it work over the network. (Worked well on local though).

So I thought that I need to spawn it by the server but still got issue understanding the logic behind all the Network stuff of Unity. And damn I can't find anything that do something like that on the internet.

So now I have a prefab bottomBar with a networkIdentity set on Client Authority with this component attached :

 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Networking;
 
 namespace ConsiliumLobby {
 
     public class Lobby_CMPT_BottomBar : NetworkBehaviour {
 
         Lobby_CMPT_Manager manager;
 
         // UI Elements of the bar
         public GameObject mapSelectionButtonGo;
         // We need the gameObject to be able to hide it completly
         public Text selectedMapText;
         Button mapSelectionButton;
 
         public override void OnStartClient() {
             base.OnStartClient();
 
             manager = Lobby_CMPT_Manager.s_Singleton;
 
             mapSelectionButton = mapSelectionButtonGo.GetComponent<Button>();
 
             SetupLocalPlayer();
         }
 
         void SetupLocalPlayer() {
             if (isServer) { // Test to know if it's the creator of the party
                 mapSelectionButton.onClick.RemoveAllListeners();
                 mapSelectionButton.onClick.AddListener(manager.OpenMapSelPanel);
             } else { // Standard player setup
                 mapSelectionButtonGo.SetActive(false);
             }
         }
     }
 
 }


For the moment I'm just trying to make the button working. Hiding it if it's not the host and if it's the host put in place the listener for the onClick event.

I can't find the right place to spawn it in the NetworkLobbyManager. I have tried in the OnStartHost method but in this place the NetworkServer (for spawning) is not active... I just can't get it.

And my other tries with this logic was on the callback when client connects to the server. But I think that a spawned object don't need to be spawned again for every client.

I try to do the same as the lobby player, but it seems that it still manage the spawn of them differently, and I can't find what I'm missing.

The question is pretty hard to define but I read the documentation and the API a lot of times without understanding how to be able to do what I want.

Does someone already done something like that ?

And maybe can someone answer these few questions : - If I spawn a prefab on the server and later a client connect. What do I need to do ? Or Unity manage to spawn it automatically ? - If an object already exist in the scene, is it local or networked ? I mean could I use this logic or my spawn obsession is right ?

I hope that a clever man or woman out there will understand my struggle. Unity Answer is my last chance before falling into darkness of incomprehension.

Sorry for my english, it may not be perfect.

Thanks in advance, and do not hesitate to ask question, it may help me describe the problem and my goal.

Kind regards,

Lionel

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Lionel_Leeser · Aug 19, 2017 at 03:23 PM

Bump

if someone already deal with that please help.

Thanks everybody !

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

119 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 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 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 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

Creating Spaceteam style peer-to-peer lobby 0 Answers

Unity networking tutorial? 6 Answers

What can prevent a prefab network instantiation? 0 Answers

Network Lobby doesnt work after update 0 Answers

Update array of game objects to all clients 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