Get object location works in LBP but not CharBP?

Hi.

I picked up on this and was wondering what reason is. If its a bug or is it suppose to work like this.
Basically i have an object and i want to get location of it.

If i say in level blueprint “object” get actor location - then it returns location of that object.
However if i go into Game Blueprint or CharacterBP. I add a variable that references Object.
And i say get location it returns 0,0,0

I am assuming its because its getting location of variable referencing object and not actual object.

It is of course entirely possible to retrieve correct location of any object from any type of blueprint, provided that 1) reference is valid, and 2) object actually exists/is initialized at point in time when location is queried.

So, when you tried this in game(mode?) BP, how exactly did you go about getting object reference, and when did you query its location?

A screenshot of your BP would help.

Hi @anonymous_user_fcb7afa8

Ok i think my issue is i cannot cast to that object.
Object is a static mesh Actor Blueprint.

In Game BP i created an object variable and selected corresponding blueprint. If i then add that reference to object it will return 0,0,0

http://s24.postimg.org/biy0x1nzp/image.png

Hey Crocopede,

variable you created references Blueprint you assigned to it, but not any specific instances of that Blueprint. You need to find a way to get a reference to instance of Blueprint in your level before you can cast to it.

One way of doing this is to use Get All Actors Of Class node. This will find all instances of class you select. You can then use a ForEachLoop to get location of each element in resulting array. This is a good solution if you only have one instance of that class in your level. It gets a bit more complex if you have several.

Hope that helps!

Thank you . Will look into this method.