Unity new version input system context.phase

In the Input System, `context.phase` is used to obtain the life cycle phase (phase) of the input operation. Life cycle stages refer to the different states of input operations, such as "Started", "Performed", "Canceled", etc.

Common life cycle stages include:

- **Started** (Started): The input operation has started, usually indicating that the button was pressed or triggered.
- **Performed** (executed): The input operation is being performed, usually indicating that the button has been pressed and remains pressed.
- **Canceled** (cancelled): The input operation was canceled, usually indicating that the button was released from the pressed state or did not complete a complete operation.
- **Waiting** (waiting): The input operation is waiting, usually indicating that the operation has been started but needs to wait for additional input to complete.
- **None**: No or unclear lifecycle stage.

By checking `context.phase`, you can perform different logic based on the different lifecycle stages of the input operation. For example, you could execute the logic for when a button is pressed in the "Started" phase, and the logic to keep it pressed during the "Performed" phase. This allows you to respond more flexibly to different stages of user input.

Guess you like

Origin blog.csdn.net/c3872931/article/details/134139553