Custom event not working outside of blueprint

I have been trying to do another custom function and I know the function works because on play it works. It is also set up exactly how another custom event is set up so I have no clue why it is not functioning.

Any help would be greatly appreciated.

your problem is likely GetActorOfClass you have no idea what that is returning but otherwise what error/problem are you having exactly?

generally speaking make sure you check all your references are valid.

my custom GPT says this.

es, there is indeed a missing reference (the “listener” or object reference) for the Object pin on both Cast nodes.

What is going wrong

  • Empty Object pins: The blue Object inputs on both Cast To Sun and Cast To Haychecker are not connected.

  • Wrong variables used: You are currently using the variables As Sun and As Haychecker (the loose blue nodes) before they have been assigned a value. This results in a None or Null reference, causing the Cast to always fail through the Cast Failed execution pin.

How to fix it

The Cast node needs to know which specific object in the game it should cast. You must plug a valid reference into the ‘Object’ pin. Common ways to get this reference in Unreal Engine include:

  • For the player: Use Get Player Character, Get Player Pawn, or Get Player Controller.

  • For the widget owner: Use Get Owning Player Pawn or Get Owning Player Character.

  • For overlaps or triggers: Use the Other Actor pin from a Component Overlap event.

  • For general objects: Use Get Actor Of Class (use this sparingly due to performance impact).

Would you like me to help you find the correct reference for your Object pin? Let me know what type of blueprints ‘Sun’ and ‘Haychecker’ are (for example, a Character, GameMode, or an Actor).

hi, what is that sun or hay checker? are they pawns or characters? or actors only?

They are actors

Can’t respawn key event be moved to character and i believe you want to respawn from a widget button click or from widget. So, if this respawn event is in character, and from widget, you can get character variable by casting and promoting to var in event construct and in that spawning will happen.