How to optimize code with one time use booleans

Hi, so I’ve written a class which may or may not need to have certain components re initialized or updated in the various built-in unity MonoBehaviour functions. On an object by object basis, I may want the components updated every update, only once, or just every time the object is enabled (Start, Update, and OnEnable).

I will NEVER have need to reassign what functions go where once the program starts, but it would be nice to be able to set which function my methods would get called from in the inspector. (So if there’s some mystic magical way to manipulate preprocessor directives from the inspector on an object by object basis that I don’t know about, please let me know!)

If I want to shuffle around where the different functions are being called, is there any way to do it in a SINGLE CLASS without a long if-else chain or switch statement existing inside Start, Update, and OnEnable?

If there’s not, I’ll just write a variety of wrapper classes that handle the updating in different combinations of Start, Update, and OnEnable, but I wanted to see if someone could show me a different (and cleaner) way.

So after swimming through members in all the base classes of Monobehavior (through reflection). I was unable to find anything that could potentially store the definable methods like Awake, Start, OnEnable, OnDestroy, etc. This could mean that they use their own built-in SendMessage functionality to call your Awake, Start, Update, and so on, through reflection. In other words, you can’t change which of those methods exist during run time (based on my knowledge).

So to answer your question, I don’t think you can do what you’re wanting in a clever way, although I am not 100% sure. You’re best bet will probably be creating the different types of classes that have only the required methods defined.