How can players select their own preferences in the lobby?
I'm not exactly sure how to ask this correctly, since I'm not that good in unity...and english is not my mother language, sorry about that.
I'm doing some simple projects to understand the new networking options in unity. What I'm trying to do now is 2 scenes. The lobby and the main game. In the lobby each player should select his "deck" (just for the example) in a dropdown, and then press "ready". Both players are taken to the main game and each gameplayer prefab (or lobbyplayer) should have the respective deck data.
Can someone give me some idea to make this setting? I don't know if some gameobjects (like the menu itself) should have a network identity, since each player shouldn't be able to see the menu of the other one. I really want to learn to work with this, but networking is definitely not my forte. I hope someone can give me some tips at least.
Answer by Dibbie · Nov 10, 2015 at 04:57 AM
Im not completely sure how youd do a drop-down UI system (it would require a decent amount of code creating your own custom one, and I dont think there is a predefined one)
However, you could even use the UI Toggle/checkbox, and put your code on its checkstate in the inspector.
So, then in your code, youd just have a public function, with an if statement that checks if that toggle is checked or not, and if it is checked, then they want Deck 1, or Deck 2 or Deck 3 or whatever.
Then you can use PlayerPrefs to save their choice to load into your next scene. Then load the details from PlayerPrefs, and then do whatever your code is supposed to do to load Deck 1 if it happens to be that, Deck 2, etc.
Your answer
Follow this Question
Related Questions
CS0030 Cannot convert type 'UnityEngine,Networking.PlayerController' to 'PlayerController' 1 Answer
UNET StopServer() without reloading lobby scene 2 Answers
Delay the spawning of networked player objects. Why is this so difficult with UNet..... 1 Answer
ClientRpc s are not called 1 Answer
How do I use an InputField to change a player object's variable? 1 Answer