Accessed none trying to read property.

Hello!

I’ve been working on a game in UE5, and I added something that got a BP class reference from “TopDownChar.” It gives me the error message "Accessed none trying to read property TopDownChar.

I have the code below. Thank you

Hey there @StretchedMonke! So the Accessed none while trying to read property TopDownChar means during construction of this class you haven’t set the variable TopDownChar. So your options are to set that variable before using it or to reference the player directly.

For my example here, I make a get node for the player actor, right click it and select Convert to Validated Get which checks if your reference is valid, then either uses it or sets the reference then uses it.

Though if this is only done once you may not need the variable at all and just the class find. This also only works in single player with one instance of that BP. Depending on your use cases, there are also better ways to go about this.

expose2

You can also expose it on spawn and pass in the character when you create the widget directly.

Needs:

  • Instance editable
  • Expose on Spawn
    Then you can pass it in directly (bp if you are passing in your pawn)
1 Like

Hello.

Thank you!

It works.

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