Search Unity

Discussion Getting other classes to listen to player input

Discussion in 'Input System' started by juicedup, Nov 29, 2022.

  1. juicedup

    juicedup

    Joined:
    Aug 18, 2019
    Posts:
    47
    My game has a period where it waits for the player to press a button to indicate that they're ready.
    Once the player is ready the doors in the level will close and the match will start.
    The player wont have any control until they press ready.
    So I need to have the game system listen to player's ready input somehow
    The way I can think of solving this problem are:
    1: create an "is ready" action-map just for this situation with one button input, and when the action is performed the player will call the game system through a reference and start the match as well as switching from the "is-ready" action map to gameplay action map
    2: use my existing UI action map that has an accept input that's also used for interacting with UI elements and have the game system class subscribe to the player's UI accept input in order to start the game


    Any feedback would be appreciated, thanks.