Announcement

Collapse
No announcement yet.

Quick question about casting object!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Quick question about casting object!

    Click image for larger version

Name:	123.png
Views:	1
Size:	63.7 KB
ID:	1185042
    Since that actor doesn't inherit from the player controller or player pawn. What is the correct node to input into the object?

    #2
    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.

    Comment


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

      Comment


        #4
        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.

        Comment

        Working...
        X