What to put as "object" in Cast node?

If I’ve understood correctly, the “object” must be a reference to that specific object I want to cast to, but I don’t really understand what to put there to cast from one actor BP to another. In my case, I want to open a door when I press a button. I have a BP_Button and BP_Door (both actor blueprints).

This is what my BP_Button looks like. I am struggling to understand what to put as “object” in the cast node.

This is my BP_Door, which is what BP_Button is trying to cast to.


Both blueprints are just actor blueprints I made myself, nothing fancy.
Any help is appreciated, thank you so much!

in order to Cast<T> on an object we need to get the Object to be cast. there are a number of ways to do this, and each one varies on complexity, redundancy, and other design choices

you can utilize an overlap collider where on Overlaps

  • lets say the Door tests for like a Player with a collider in the beginOverlap() it would Cast the Other Actor to the BP_Player then set a variable in the BP_Player to say “there is something to interact with” or " there is a Door that can be opened" along with somehow registering itself to the BP_Player. then the Player “does a thing” which fire off in your case the OpenDoor()
  • let say the Player have a collider that looks for interactables (in this case Doors) then when there is something inside that collider that can Cast to an Interactable, the Player can then issue a command to Interact() on that interactable (in this case OpenDoor())

another method is to utilize Traces of some kind, whether that be Line Trace, or Sphere trace

  • when the player hits the command a trace is performed then you go through the results and try to cast it to the given type to then call a given function on it.

there are other methods utilizing managers, but these can get very complex for moderate amounts of positives unless your design needs such.