Casting issues

i am trying to cast to an actor and run a function in its blueprint but it keeps failing and telling me this:
Blueprint Runtime Error: “Accessed None trying to read property item_respawn”. Node: Respawn Item Function Graph: EventGraph Function: Execute Ubergraph Paper 2DCharacter Blueprint: Paper2DCharacter

Check Trigger Box Object Ref. Sometimes Blueprint cannot update some variables in the blueprint. Replace Respawn Item function with Print string and connect As Item Respawn output to Print string. It will show you the name of the object is in use.

Try recreate Trigger Box Object Ref variable.

whenever I call cast to, it always prints out “failed” and if I connect the “as item respawn” pin to the print string, it prints out nothing. I also deleted and remade the trigger box object ref variable, and it still didn’t work. BTW item_respawn is a child of trigger box so I’m not sure if I’m supposed to put the trigger box object ref into the object wildcard or if I’m supposed to put in the item_respawn object ref into the object wildcard.

Believe this means that TriggerBoxObjectRef is empty. Can you how you are assigning its value?

I just created a variable that is a trigger box object reference… That’s all I did.

Then it is empty. You need to assign a pointer of an actor to it or the cast will always fail and you’ll keep getting Accessed None every time you try to use it.

Recomment you check this tutorial: Direct Actor Communication Quick Start Guide | Unreal Engine Documentation

2 Likes

Thank you very much!

2 Likes

Sadly, that tutorial is outdated because I am using Unreal Engine 5.
however, if it is not out of date and still works, then please tell me how to get this node into my blueprint.