Access Actor variable from level blueprint

This is based on the sidescroller template.

What should happen is this:

When 1 is pressed, get all people actors and for each of them print the name to screen & check if the variable “Right” is set.
If Right is set move to right target if not move to left target.
However my “people” always move left and i get the error “Error Accessed None ‘PeopleBP’ from node Get All Actors Of Class in blueprint SideScrollerExampleMap” after i hit play and exit again :frowning:

“People” is a child of the Sidescroller character:

My variable in the people blueprint looks like this:

It’s exposed at spawn and set to public

I really don’t know why it doesn’t work :frowning:

I would appreciate any idea! :slight_smile:

It doesn’t look like you are assigning PeopleBP any value, at least in the provided screenshots.

Are you setting PeopleBP to anything?

In general “Accessed none” means your reference is invalid so check where it tells you it’s broken.

In this case we have “Error Accessed none “PeopleBP””. That tells us quite a lot. In this script we have exactly one node called PeopleBP so we don’t even have to find out which one is meant. You want to check “Right” for each “People” actor. The variable PeopleBP however references simply an actor which you don’t set in this script.

I highly assume you never set this variable at all and it’s just an empty reference.

…so the very simple and easy fix is to just use the output of your “Array Element” from the ForEachLoop for your “GetRight” (the boolean). You might have to cast it to “People” first which you can do via a simple “Cast to People” node and use the output of that.

I hope this helps.

Cheers :slight_smile:

I didn’t know about the casting stuff so i’ll read up on that first :slight_smile:

I’ll try your suggestion later when i’m back at home and then report back.

Thanks alot! :smiley:

Cast to people worked fine! Thanks again! :smiley:

Could you accept an answer to make it clear to people browsing the answerhub that this is solved?

Thanks :slight_smile:

I would if, if i could :wink:

I can’t upvote because i get a popup that says: “Request method not allowed” in chrome, firefox and ie.
I also don’t see any button to accept an answer.

Oh. Well could you tell me which one you would like to accept and I do it this time

Also are you using the answerhub in German? Because for some reason that was broken recently and I’m not sure if it’s fixed by now.

Yes i used answerhub in german… switched it back to english and now everything works fine. Thanks… again. :wink: