Hi guys, “Cast To …” I have a problem with the function, if I call a simple function (without the class) it gives me an error when compiling, if I use the function to obtain the Class ( Cast To … class ) that when testing UMG just flies all the time gives a warning …
You need to provide the object to Cast to SelectLevelMenu. You will need to get a reference to the blueprint you want to cast first, because you’re spawning it in that script itself you can simply store the result of Create Select Level Menu Widget as a variable, and provide that to Cast to SelectLevelMenu
However, in this case because it is already a SelectLevelMenu there is no need to cast it.
Think of “Cast” as a way to interpret an object as something else. It’s not a way to retrieve an object.
You don’t need to cast an object into itself, that’s why you’re getting the warning, just remove the cast node altogether - you already have a SelectLevelMenu as a result of having just spawned it in the same blueprint and execution chain. If you’re getting a crash you should post the crash log in a separate question (it’s unrelated).
Ah also, make sure you reply to an answer rather than replying with an answer. It will make it easier for people to help you
Thank you =) I did as I understand what you said and I now always selects a default value that I put in SelectLevelMenu, turned out is such a chain of actions: