❔ Abstract forced empty constructor inheritance
As shown in the pictures, do I really have to have these empty constructors in my child class if I want the functionality of the abstract class's constructors? If I remove them from the child, I get an error:
CS1729: 'PlayerAbility' does not contain a constructor that takes 0 arguments
22 Replies
yes, you do
:(
...why do you have a destructor
Does this indicate I've bunged up my design, or is this typical?
I mean, it's fine
that's cursed
don't do that
If I don't stop the Coroutines I'm gonna get some nullreferenceexceptions
Should I just stop them in the method that removes the ability?
do those coroutines reference this class
yes
do they keep an instance of this class
then this destructor will never be run while those coroutines exist
destructors are run when the GC collects an object
which cannot happen while it is referenced somewhere
ah
sorry, finalizers
C++ calls them destructors
yeah, that's an instance method
the destructor won't run until that coroutine is done
i have the coroutine on the ability object, but it is being run on the player since the ability is not a monobehavior (unity)
so im good to just delete the constructor?
delete the finalizer, yes
if you're using a finalizer outside of like, native file handles, you're probably doing something wrong
i might run into some weirdo stuff with ui trying to update the cooldown of an ability after its been taken off but ill deal with that when i get to it
thank you for your help
unity cleans them up when the object gets destroyed, at least it should in pronciple
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.