Created
December 3, 2024 18:18
-
-
Save Shilo/7455417ddc05bdd74b186be1f6ce6694 to your computer and use it in GitHub Desktop.
Godot 4 GodotObject helper methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static partial class GodotObjectExtension | |
{ | |
public static GodotObject NewWithScript(this GodotObject obj, Variant? script) | |
{ | |
script ??= new Variant(); | |
ulong id = obj.GetInstanceId(); | |
obj.SetScript(script.Value); | |
return GodotObject.InstanceFromId(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment