This is done based on EventListener custom events.

There are two ways to listen to events in the system. This is the first way to listen, and it is also the recommended way because it is more clear. Another important reason is that it is event-based, so it supports network replication!

If you want to learn about the second way, please go to Interaction Implementation Method 2

1. Precautions

To use EventListener, you must first execute EnableEventListener.

Untitled

2. Interactive Messages

EventTag: (TagName="InteractionSystem.ToggleInteractableMessage")

Customized event notifications for the interactive system: switching interactive messages; generally used to switch UI prompts or to initiate some possible initialization operations within an object before starting an interactive action.

Untitled

3. Start interactive event

EventTag: (TagName="InteractionSystem.Interact")

Customized event notification for the interactive system: Start executing interactive events; usually triggered by a player pressing a certain button or other input method. Here is to handle specific interactive events (such as opening a door, putting items into a backpack, or other)

Untitled

4. End interaction event

EventTag: (TagName="InteractionSystem.EndInteract")

Customized event notifications for the interactive system: the end of an interactive event; this event is usually triggered when the player releases a key or other input method, or when the player no longer focuses on the object. You can implement this or not as needed. This is just an example.