Download

How to get an array that a behavior tree can acess

I’m trying to get an array that i can access in a behavior tree. I tried just making a new blueprint, adding an array, and casting to it, but when trying to cast to it it always fails. Casting has always been such a huge bummer for me. Every time i encounter casting i stand hours trying to figure it out i search everywhere, the documentation , forums, youtube, reddit. But in almost all examples, casting is either in a begin overlap event or in a pawn (so you just use get player character or player pawn as an object) Never, however have i seen the type of casting that i need. And that’s casting to a blueprint (only one in the level) that doesn’t overlap anything and isn’t a player.
Help please!

So, you want to get access to an array that it’s declared in a BP, which in turn exists in the level (one of a kind). Is there any relation between this BP and the AI (pawn or controller) that uses the BT?

If not, then just “Get All Actors of Class”, get the first one in the returned array and there you go.

I work with game instance alot. You can put the array in game instance while the game is running it will be accesible from everywhere easily.

I ended up doing that. My mistake was having context sensitive ticked and couldn’t see all the options. Thanks anyways, much appreciated!

I will look into that! Thank you!