I wanted a really simple Lobby Scene where players could press a button and it would register on the screen. When all the controllers had been pressed then the game would start.
Creating a new scene
…and calling it Lobby
Creating UI elements
I created a Canvas, and will put 4 coloured box’s with text in them on the screen.
On the box I added a little script called Press To Start
Press To Start Script
When the script is done it looks like this in unity.
- It has a yes/no to say if it’s good to start (Start)
- Which UI text the script is linked to (UiText)
- Which button it is checking for (buttonName)
- Which player is attached to that controller (playerName)
This script uses the UnityEngine.UI – so that needs to be delcared
I have talked through the other variables above:
And then I check if there has been an input and then display this through the UI.