Removing any UObject derivative is simple in UE4. When you are ready to delete your UObject-derived class, we will simply call a single function (ConditionalBeginDestroy()) on it to begin teardown. We do not use the native C++ delete command on UObject derivatives. We will show this in the following recipe.
Destroying UObject-derived classes
Getting ready
To complete this recipe, you will need to have an object (objectInstance, in this case) that you wish to destroy in your project.
How to do it...
- Call objectInstance->ConditionalBeginDestroy() on your object instance...