Trying to reference after actor gets destroyed

Okay, so basically, I want my character to pick up a rifle, then be able to use it afterwards.
My character has a primary weapon reference set up after a blueprint, and the rifle the character is trying to pickup is a child of that blueprint. So I’ve set a reference to the blueprint before the actor is deleted, then a pickup script is ran.

After this, obviously the actor is destroyed, so the self reference becomes null. I’m just trying to see if there’s a way I can save this reference so it’s still in effect after the actor is destroyed?

Cheers.

If you have a reference to an object that is destroyed it will point to nothing.

Couple of options:

  • Not destroy it
  • Have a variable to indicate you have the rifle and use it to check if you can recreate it

If I have multiple pickups though, wouldn’t that just clog the map with old hidden bp’s?

If you disable collision and set visibility to false the actor should have almost no impact on performance AFAIK.