Part 7a Gamemode with chatbox

Back to main post

We are going to create a chatbox on all clients.
All steps are also explained in a video at the end.
Note : When building you sometime have to go back and forth.

Scheme

Step 1: Create widget FD_ChatWindow and FD_ChatText

FD_ChatWindow:

FD_ChatText

In grap add variable IncomingText which Exposes on Spawn
Bind IncomingText to Text Block

Step 2 Add FD_ChatWindow and chatbutton in MainMenu.

Add ChatWindow and chatbutton
Blueprint Chatbutton

Step 3 : Blueprints FD_Chatwindow
You first have to make some events at the playercontroller

Blueprints Chatwindow

Step 4 : Add mainmenu in playercontroller, delete from gameinstance!

Disconnect ShowMainMenu in Level Blueprint ThirdpersonExampleMap
Add variable ScreenMenu and Load MainMenu in Playercontroller

Step 5 : Gamemode

Blueprint Gamemode

step 6 : Playercontroller

ProjectSettings > Input > add binding chat enter

Binding chat with enter
Blueprints Playercontroller

Video explaining

Video demonstration chatbox

Extra : Adding the mainmenu through the gameinstance.

I did not like my solution, where I added the mainmenu widget in the playercontroller instead of from teh gaminstance. Ofcourse both solutions are correct, but I want to keep the menu widgets on the gameinstance. So I made the next corrections.

Reconnect in level blueprint thirdpersonexamplemap
In gameinstance use Event show main menu
in playercontroller, this part is not needed anymore
Changed event UpdateChatWindow in playercontroller

If you run, you will get the same result. In my opinion the second solution is more consistent with the idea to keep the menu’s on the gameinstance

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.