Event Binding

Reacting to server events in Blueprints

To make your custom UI react to the server, you must bind Custom Events in your Widget Blueprint to the MP_ChatClient component's Event Dispatchers.

Step 1: Get the Component Reference

Inside your main Chat Widget's Event Construct, get the Owning Player Controller and call Get Chat Client. Save this reference as a variable.

Step 2: Bind OnMessageReceived

This is the core event that updates your chat window. Drag off your reference and call Bind Event to OnMessageReceived.

  1. Create a Custom Event (e.g., HandleNewMessage).
  2. Break the FMP_ChatMessage struct output.
  3. Access SenderName, MessageText, and Timestamp to populate your text blocks.

Step 3: Bind Room Events

To dynamically add/remove chat tabs, bind to OnRoomJoined and OnRoomLeft. Use these to spawn or destroy UI tabs associated with the incoming RoomID.