Quick question about casting object!


Since that actor doesn’t inherit from the player controller or player pawn. What is the correct node to input into the object?

It is easier for you to get a reference of that actor instead of try casting from some of the default references bp nodes (Get Character, Get Controller, Get Game Mode, etc…).

I suggest you to store the reference of Mob1 when it is spawned. If it is inside the level, you can always use Get Actors from class node. Just remember this node can be expensive, so use it once and store the results in an array.

Cast is used to filter a reference you already have from an object/actor to a specific inherited class of it.

Alright thank you! I ended up using the node Get all actors of class and then a get node. which works! :slight_smile:

Nice!
I guess, by the context of your code, you would use this frequently, so be aware that the more Mob1 classes you have in your game, the more expensive this node could be for you.