Casting from AI controller to Spawner

Hey, let me just pipe back up here for a second, @doctorpepperdan was saying everything I had planned to say when I read your reply post :smiley: until we got to “Get Actor of Class”.

Get Actor of Class I believe only returns the first of an actor of that class in the world outliner. No good when you need a SPECIFIC one.

Also, you do NOT have to use a behavior tree/blackboard. Especially if they’re simple pawns, all a blackboard/behavior tree is is a different UI to do the same things, when it gets complicated they’re incredibly more useful, but for things like this they’d probably be overkill.

What they were saying, @GhostInTheCommu, is you put the “GET OWNER” node on the creature. If you plug in “Self” on the spawner into the spawned actor, that registers the spawner as “Owner” to the creature.
So, if you do that, “Get Owner” gets the Owner, which would be the spawner. But there’s a better way.

On your creature, make a variable “Spawner Ref” of your spawner class.(1) Then make that “Instance editable” and “Expose on Spawn”.(2)

Now, when you go to spawn the creature, there will be that variable, exposed on spawn, see: (3)
Pass in “Self” which here would mean “ME, I AM THE SPAWNER” and auto-sets that value on the spawned creature.