Download

Issue with arrays of widget references

Hello,

I’m trying to save and recreate between 1-100 custom text widgets into a chat log which displays an image corresponding to the speaking player, the character’s name, and the chat text. Here is the Blueprint I am using both to add the messages to begin with (which works fine) and to reconstitute it after recreating the HUD (which doesn’t).

jHJBTcc.jpg

Instead of displaying each widget in the array in turn, it prints the most recent widget once for every widget I’ve added to the array.

Here is the controller code that deletes and remakes the HUD (including saving the chats array while the HUD is off).

RtnSxoO.jpg

Any help as to why that would happen would be much appreciated.

Hi, i not checked that all, but if you dont travel through levels, you dont need to save chat…

Create master widger window and when someone send message, create simple widget box with sender name and text and add this box widget to master widget scrollbox.
Then just show/hide master widget depending on chat traffic…
I think there is in widget something like “child index”, if some chilx have index 100 then just remove it :slight_smile: i saw one tutorial doing this and it was simple and effective

I think guy who have YT channel “unreal tek” have this tutorial

Hi! Thanks for your reply.

My game will move between levels, so being able to store and recall the chat log is important. Thanks for the tip on removing the 100th widget, though, to keep it from becoming too cumbersome. I’ll probably do it the opposite way, though, removing earlier chat messages over time (while printing all chat messages to an external log).

Can you suggest what I might be doing wrong with the array?

EDIT: Nevermind, need another look

i think that code is bad… i tried to read it but i really cant…
i recommend you to make logic where is 100th widget automatically removed so when it comes to save/load, you dont need to play with indexes. just forloop save and forloop load.

I realized that there was no need to loop to remove the excessive message, because this script fires each time a chat log message is created and thus the array would never have more than one additional element over the permitted total. This is what it currently looks like. It is still producing the same error:

9a1ce6293e912d6c9c29f60b4eb43c1ff0414657.png

Perhaps for some reason it is simply copying the last widget in the array over and over?