Always Invalid Actor

Hello!

After conducting numerous unsuccessful searches, I can only turn to you to solve my problem. Please note that I am a complete beginner on Unreal Engine.

As you can see in the screenshot, I’m trying to change the text of a widget based on properties of an actor placed in the level. However, the widget is unable to find it. I really don’t know what to do. When I launch the level, the actor is always invalid, and thus, no text is displayed.

What should I do? Thank you.

1 Like

When you create a variable of some Actor class inside another actor BP you’re not creating the actor, you just created a variable that can hold an actor.
Then you actually need to put the actor inside that variable to get a valid variable with an actor inside because your problem here is that you are trying to read an empty variable.

is the actor in the scene?..this actor is unique or you have multiple actors of the same class in the scene?

if you actually dropped the actor in the scene and want it to put in your Widget variable,

then in the construct of your widget you can add GET ACTORS FROM CLASS … this will output an array (all the actors found in the scene) then from the array do a GET of index 0. This will output the first actour found and set your variable with that results. This way you will have something in your variable and the program should work.

Also you have a not that says that you are casting a variable of the same type of the cast so that is not needed because unreal already knows the class of that variable.

Cast is used when you have a generic actor and need to access as some specific class.

2 Likes

Thank you for your response! It does work indeed, but not in the way I would like. I forgot to mention that the widget is supposed to fetch the information when the Bind event is called. It does receive the instruction to display something but fails to fetch the information, specifically from the active actors at that moment. I’m not sure if that makes sense?

Essentially, I’m trying to explain that there are multiple actors with the same class in the scene, and when one of them performs a certain action, its properties should appear in the widget. However, the widget struggles to determine which actor is performing the action.

Here you can see that the widget takes the active actor from the array element of the custom event.

I also noticed that I have this note on my Bind Event, maybe the issue is here?

The ‘template’ project from which I pull this code has this note, and it works there. What’s different?

Thank you

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.