Hello everyone, Im wondering if there’s a way to mimic the OnDestroy function on monobehaviour for regular class. for example
i want to count how many instance of this class.
public class MyClass {
public static int MyClassCounter;
public MyClass() {
MyClassCounter++;
}
public OnDestroy() {
// will be called when Garbage Collector collects it ?
MyClassCounter--;
}
}
Thank you. ![]()