I have a script that I want to run before any other script. I want to change its execution order settings. I could do that using the Script Execution Order Settings option from within Unity, but I want to do this programmatically.
The reason I want to do this programmatically is because the script has an abstract class, and I want to avoid requiring the user to change the execution order every time they extend the class. Changing the execution order of an abstract class is not an option in the Script Execution Order Settings. My abstract class has reference to every class that extends it.
How can I change the execution order of a MonoBehaviour? An example of what I am looking for would be along the lines of:
MonoBehaviour myBehaviour = GetMyMonoBehaviour();
myBehaviour.ExecutionOrder = -100;