What is the proper way to destroy an object being used by an ability?

I have a few abilities like a pick up weapon and a bomb that destroys the object that the ability is triggered by. Whenever I Destroy that gameObject that you are interacting with, I always have an error that says the GameObject is not available. What is the best way to accomplish this with the Ability system?
 
What is the stack trace? Are you using the Detect Object Ability Base Ability?
 
Yes, I'm using the Detect Object Ability Base Ability. It's happening in the OnTriggerEnter event when it is validating the other object. I have found workarounds by transforming the object somewhere else. That seems to work. Anything less than that and I get the error that says "MissingReferenceException: The object of type 'GameObject' has been destroyed bu you are still trying to access it." This happens on the DetectObjectAbilityBase.cs 269.


DetectedObjectAbilityBase.cs:269
DetectObjectAbilityBase.cs:130
ultimateCharacterLocomotion.cs:761
UltimateCharacterLocomotion.cs:699
CharacterLocomotion.cs:486
KinematicObjectManager.cs:202
KinematicObjectManager.cs:751

Hope that helps clarify.
 
Top