Access violation reading location 0x0000000000000320

I’m currently learning C++ Unreal and seems like when I do this certain if statement it absolutely trashes itself. I’ve given pointers to the selected objects already yet I’m seeing Exception Thrown. Just a little confused of what’s going on is all, and would love an explanation on how a certain solution works, thanks.
OpenDoor.cpp


OpenDoor.h

Is PressurePlate a separate actor? Did you set a reference to it?

If this isn’t considered a reference, I’m not sure what isn’t. I have the trigglevolume in place of pressure plate.
image

I’ve seen to broken down to the main problem and it’s definitely something about AActor*. Perhaps there’s a work around?

My advice: make it event-based, not tick based.

  1. Make trigger a component of the door, not a separate actor.
  2. Add Begin Overlap event for the trigger.
  3. When overlapped, check if the overlapping actor is of type that can open door. I’d use an Actor Tag for that, but you can do it some other way.

This way you get rig of strong references and will be able to reuse the same setup will various actors with minimum additional work.

1 Like

Thank you for replying, and it seems like I found a completely unexpected solution. As you suggested about references, I forgotten that I had copied over the doors with the same component, and none of them had references. Rookie mistake I must say haha, thanks for helping out, and will take that advice as well as I continue on my journey. :man_bowing:

It can’t find the pointers you alocate, 0x000 is an empty address. Meaning the data you were seeking at the specific address could not be found.
This means for some reason your pointers are empty and the pointer variable allocates invalid data that is partial or no data at all.