- Home /
How do you restrict UI Navigation to only 1 player?
I'm working on a local Multiplayer game, using the new input system. I'm wondering if there's a way to restrict my menu UI navigation to just 'Player 1'.
Similar to some other couch co-op games, where 'Player 1' is the only player able to navigate around the menu and change stuff.
Answer by lvskiprof · May 27 at 09:57 PM
I assume you have some class, like a Player or PLayerController, where you have the user number set that each player has been assigned, correct?
Simply provide a way to get that ID in the class where you have your UI navigation. If possible, set it in a local variable in your Start() method. Otherwise, just check for it in the navigation methods by calling the method to get the current player ID and only allow navigation events to work if they are Player #1.
Unfortunately I don't have a UI Navigation class. I'm using the default Input System UI Input Module component and the navigation setting within the Button components to navigate the menu.
I am not sure how you can do it that way, since it has no concept of the player IDs.
Your answer
Follow this Question
Related Questions
UI Buttons - affects all 0 Answers
Unity 4.6 UI Lags on android 0 Answers
How make UI scroll movement effect? 1 Answer
2D Collider larger than specified 0 Answers