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 Piflik · Jun 25, 2015 at 10:40 AM · uinetworking

Unity Networking and UI

I am currently delving into the new Networking functionality in Unity 5.x and I ran into a small problem.

I have a simple script on my Network Manager object similar to the Network Manager HUD, but using the new UI system, with two buttons to host or join a game. I have a Menu scene and a Game scene, both setup in the respective slots of my Network Manager.

The buttons work as expected, when I start the game, but when I am returned to the offline scene, after the hosts shuts down, the connection between the buttons and the script is broken.

Any idea how to fix this?

Edit: Putting my script on a different object and getting the NetworkManager component via 'FindObjectOfType()' fixes the connection with the buttons, but breaks something else.

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
1
Best Answer

Answer by Piflik · Jul 13, 2015 at 12:11 PM

I hacked together a solution, that I don't particular like, but it works. If someone has a better solution, I'd still be glad to hear it.

I added this script to the canvas, to create the button connection on runtime.

     ConnectionManager _conMan;
     [SerializeField]
     Button _joinButton;
 
     [SerializeField]
     Button _hostButton;
 
     void Start () {
         _conMan = GameObject.Find("NetMan").GetComponent<ConnectionManager>();
 
         _joinButton.onClick.AddListener(() => _conMan.JoinGame());
         _hostButton.onClick.AddListener(() => _conMan.HostGame());
     }
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 edusca · Oct 01, 2015 at 03:24 PM 0
Share

Hi can you post how the JoinGame and HostGame looks like? I'm searching and trying to find wich is the best method to launch a client from custom HUD and different scenes, thanks in advance.

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

22 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

Related Questions

Unity Networking player own UI 1 Answer

The Dropdown UI Element does not render DropdownList child once you add a NetworkIdentity to its parent Canvas. Any idea why? 0 Answers

Anchor point moving when connected to Server 1 Answer

Multiplayer UI : What's the best implementation for a waypoint-like system? 0 Answers

How do I stop EventSystem.currentSelectedGameObject from changing on a button press 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