So, we are attempting to make a Chat System using the new UMG features. We currently have the ability for players on a local machine to connect to each other and walk around and interact with objects.
Our attempts at making a functioning chat system have been unsuccessful. We first starting by making a simple widget, that is populated by a Scroll Box, an Editable Text, and a Send Button. Pretty much, you can type into the Editable Text, press the Send Button, and the Editable Text is cleared and the system makes a new “Chat Text” widget and adds it as a child to the Scroll Box. That all works and is great. Now I understand form there, that when one player does it, the other player will not see it, so we have made attempts to have the other player see it. Unfortunately, scroll boxes and other UMG elements can not be replicated at this time. (Would making the scroll box replicated work? I have no idea, I’m not fairly clear on the whole Networking thing)
So, we ended up making a replicated array of widgets with in the chat widget. We updated the Array and and still, both players can not see each other’s messages.
Any idea on how to get a system like this working?
You could pass the content of the editable text field (text variable) to a string via an interface function to gamestate, and replicate it over from there and then use another interface function to send it to the other player’s HUD/widget.
Hm, i would try to make a replicated TextArray. If the player presses “Send”, the Client tells the Server to add this Text to the array and replicate it to all other clients. Now every client should have the same Text inside that array.
You can than use the array to display the text inside the chat with a for loop.
I guess you would need to make a function that is fired on every client everytime the array is updated. This function should either rebuild the UMG widget and in its contruct function you would add a text for each element inside the textarray. Or you could just update a widget by using a bool that is changed to true if a new string was added and than starts a for loop at its end the bool will be set to false again.
EDIT: I think with this you can also let the server check your player name for being an admin and filter admin comments like /give item 10 or something like that
I think it doesn’t work because you are replicating from the client which doesn’t own the umg widget. You will need to have the client “own” the object. I was thinking about having the player controller involved to send the new chat and have the umg widget use the sent text from the player controller and add it to the scroll container.
Did you ever get to try it out or anything like that?
I was working on an UMG chatbox window earlier today.
But i could not get it to work, also it crashed my editor everytime i spawned it.
I would really love to have a chatbox working.
Just got mutliplayer to work over LAN. Trying to get it to work outside of LAN enviroment now And a chatbox would be super awesome with that for interaction!
Thanks for sharing your thoughts on UMG chatting.
No sorry, i did not. But if i find some time (currently working on an Source Engine Contest) i will try to create a basic chat for you.
Awesome eXi !
Looking forward too that!
also Good luck on your Source Engine Project !
Sorry. I still hadn’t time to look into this, but i did not forget about it.
Currently i’m working on a small Character to work with UE4 again and i have a lot to do with Uni, since tests are coming near (4 weeks).
As soon as i find a night to get into this, i will try something, but i can’t tell you when.
Did you find a solution yet? I’m working on a chat system and when I find a solution I can post it if you want.
No you can’t pass content from client to GameState. Hope other people will pass this over unlike me.