Accessed None - trying to call function from another BP

Hi, I’m trying to open a door on a button press. I’ve made an input action to interact with objects and a function to open the door on the door BP (I know the function works because I use the same nodes on another BP that opens the door on a timer). I’m calling the function on input (E) in the first person character BP using an object reference to the door BP (Activated Door) to call the Open Door event. I keep getting the error “Accessed None trying to read property Activated Door,” which directs me to the Open Door node on the first person character. The debug string for the key press is firing, but the door is not moving nor is the debug string appearing. I’ve also tried casting, but I couldn’t get that to compile correctly. Any ideas??

EDIT: I just changed the E event to an input action event in the first person character BP, but the results are the same.

Can you show how do you set that variable named “Activated Door”?


Here you go, it’s an object reference variable.

Yeah but how do you reference the actor you want inside that variable?

I’m sorry, but I don’t know what that means

I think your variable there doesn’t reference any actor, at least on that time.

Either:

  • After Begin Play, get the Get All Actors of Class node, select your actor from the dropdown menu inside the node, connect the Out Actors pin of the node into a Get (copy) node, leave it’s index as 0, and connect the Get node’s output pin into the set type node of your variable.

Or

  • If there’s a detection involved before getting to use that door, can be with collision volumes or line traces, set your variable to the hit actor (if there’s a possibility that the hit actor can be another actor, check that by comparing the display name or tags)
2 Likes

Thank you!! I’m using the first solution for now and it’s working perfectly :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.