Skip to content

RunTimeInitialization

Gabriel dos Santos Severino edited this page Dec 30, 2023 · 1 revision

(namespace: Cobilas.GodotEngine.Utility.Runtime)
The RunTimeInitialization class allows you to automate the Project>Project Settings>AutoLoad option.
To use the RunTimeInitialization class, you must create a class and make it inherit RunTimeInitialization.

using Cobilas.GodotEngine.Utility.Runtime;
//The name of the class is up to you.
public class RunTimeProcess : RunTimeInitialization {}

And remember to add the class that inherits RunTimeInitialization in Project>Project Settings>AutoLoad.
Remembering that the RunTimeInitialization class uses the virtual method _Ready() to perform the initialization of other classes.
And to initialize other classes along with the RunTimeInitialization class, the class must inherit the Godot.Node class or some class that inherits Godot.Node and use the RunTimeInitializationClassAttribute attribute.

using Godot;
using Cobilas.GodotEngine.Utility.Runtime;
[RunTimeInitializationClass]
public class ClassTest : Node {}

RunTimeInitializationClass

/*
bootPriority: Represents the boot order
{ (enum Priority)values
        StartBefore,
        StartLater
}
name:The name of the object
subPriority: And the execution priority order.
*/
[RunTimeInitializationClass(Priority bootPriority, string name, int subPriority)]
[RunTimeInitializationClass(Priority bootPriority)]
[RunTimeInitializationClass(Priority bootPriority, string name)]
[RunTimeInitializationClass(string name, int subPriority)]
[RunTimeInitializationClass(string name)]
[RunTimeInitializationClass()]