Please Change EVERY unity reflection function to `virtual`, and never use `private` keyword

Justus

Member
Since UIS is designed to be customized by user himself in various situation, inherit class and override it a very common usage.
So every unity function like Awake/Start/OnEnable/OnDisable should be virtual and don't use private keyword.

I have encountered this issue many times, this time the specific problem is coming from `PickupBase.cs`
1677295792270.png


Ideally, the root of this inheritance chain is `InteractableBehavior.cs` , if any subclass like `PickupBase.cs` need use unity function, we'd better add a virtual empty implementation in `InteractableBehavior` and override in subclass. so that we could make sure no any unity function will be overlap by subclass.

In this case I write a custom MyItemPickup.cs and add my necessary logic in OnEnable, and then I find my picker will not be re-actived after several uses, after debug I figured out that problem is cause by this OnEnable function, I could not call base.OnEnable for it.

(my principle is never change any code of plugins directly, so each time when I encounter this kind of issue, I remember it deeply)
 
Last edited:
I completely agree this was an oversight on my part I'll make all of those virtual for the next update
 
Top