I’m trying to have a pawn to move to an actor location when a HUD button is clicked, but somehow the new location is always (0,0,0) meaning the actor is invalid.
The general structure is:
A widget with event dispatchers for a OnClicked:
A pawn binding that widget with a custom event that GetActorLocation and set new relative location:
The actor variable that you see there “Object” is referencing a specific actor. This actor contains no blueprint, there’s no function within it just geometry.
When you create a variable of a ‘type’, it is set to NULL until you tell it to reference something. Think of the scenario of ‘I have 20 different SCR-B1-01 in my level, and which one is the variable referencing?’.
Somewhere up the line, before you access the get node, you will need to Set SCR-B1-01, either through a ‘Get all actors of class’ node, or by some other means.
Hi Aesais, thank you for your answer, it worked wonderfully, I had no idea that I needed that.
I’ve used to get all actors with tag, as I think it fits better what I want.
Now I’m trying to get a specific variable inside the selected actor, but somehow it’s not allowing me to find it. I assume because I didn’t explicitly declared the actor, as I’m setting the "Object from an array? The said variable is public within the actor.
It would be amazing if you could give some tips with that as well
‘Get all actors of class’ is like tags, but gives you an array of that specific class in the level. If you need to convert to your specific type, use a ‘Cast to xxx’ node, and then you can access variables/functions from that class.
So text example: Object —> Cast to x —> functions/variables!
(Be sure to drag off of the blue points on the object and cast node so that the menu shows what you need)