Remove from Parent is better than SetText to blank

An easier way to deal with temporary text that I did some research on is using the “Remove from Parent” function. It basically says the function removes the widget from the parent widget so it essentially just removes it from the screen.
Note: This only works if the text is only going to be seen once. Since Announcement is being used as the “Game Over” text, it needs to be set to blank after its initial run.

Also general reminder too, make sure you set your HUD text to the text that you want to use instead of using filler (or test) text and then blueprint code to specify what text you actually want to use. It’s just a lot easier.

I don’t see why this would be easier. It uses the same amount of nodes and leads to two issues:

  1. If you end up wanting to reuse the text, you will have to rewrite the code. Deleting it only makes sense if you’re 100% you don’t use it anymore.

  2. This can lead to errors. Imagine you delete the text but you still access it somewhere in the code, unintentionally. Especially in large projects this is easy to miss. It’s not safe to have to have functions pointing to variables that can be deleted unless you’re putting “Is Valid?” nodes everywhere.

I recommend not changing the widget too much so you know at any time what components it provides.

Yes, you are correct. You would want to verify that you are only using the text once. In this case, it’s perfect because it’s only used in the opening section and never referenced again. If you are using it again but want to change any of the properties of the text, you may just want to use a different HUD widget than writing all the code to change the original.

I was also thinking about performance as well. Would an empty widget use any more resources then if the widget is removed completely?

Set Visibility would be better in my opinion, since you can just make it invisible.

Agreed, setting visibility would be the better option. With setting the text to blank being the next best thing.

Privacy & Terms