Get Location Of Blackboard Object Reference

Hello everyone!

So I was messing with the behavior tree and blackboard, and I wanted to save object reference in a such way that I could get its location later on when it is changed.

Well, something like this, but I can’t quite connect these two because one is returning object reference, and the other one is asking for scene component object reference.

Thanks in advance!

Cast it to an actor object doesn’t have transform by default, its the most basic class type.


Thanks for your help! This is the solution I was aware of, but I didn’t want to use casting since it said it was costly. I guess I was just being stupid… So thanks a lot for you solution!

if you want to skip casting and just want location then you can just have a blackboard variable that is a vector and then just access it directly.

Yes, but in my case, the location is constantly changing, so it needs to be constantly updated, so I think casting is a better choice than that.

Objects are abstract, they don’t have transforms and can’t be places on scenes. You could use GetBlackboardValueAsActor and it will automatically cast your object to actor, but you should be sure that your blackboard key stores actor, otherwise you would get an error. You also could cast your object to actor, it may be a better decision, if you are not 100% sure, that it is an actor, cause you could always check, if the cast succeded.

1 Like

@user_goodman011 Sure you can set the base class as actor but the thing is you can’t just call get value as actor from the blackboard. You only have access to “get value as object” to extract it, so you still have to cast it.

The object key is a catch all objects in this case. Think of it as an object wildcard box. It doesn’t strip down an actor to an object base class it just holds anything derived from object.

My code works.


Yes now I get it, unreal just has many different things that I need to get used to, thanks for the nice explanation.

@3dRaven @Xvixicho
Sorry, I wasn’t clear. This node is only accessible from behaviour tree related stuff. Hear you can see, i called the node from the task blueprint it does not make unnecessary cast, which is good. But you need to keep sure, that you put actor as a base class in your blackboard (it could be any other class, I just usually use actor, because it is enough). Not everyone knows about this stuff, but good to know.

1 Like

So as I understand this returns the actor of the object type of key? I am talking about “Get blackboard value as actor”.

Edit: oh wow I understand it now, this is so useful, I can get rid of so many unnecessary casting using this! thanks a lot!

1 Like

It only works within blackboard tasks and areas. In the main scene you need to cast.

1 Like