A class stored as a resource.
    public abstract class Script : Resource

A class stored as a resource. A script exends the functionality of all objects that instance it.

The new method of a script subclass creates a new instance. Object.SetScript(Godot.Reference) extends an existing object, if that object’s class matches one of the script’s base classes.

Inheritance Chain

Derived Classes

Properties

    public string SourceCode { get; set; }

The script source code or an empty string if source code is not available. When set, does not reload the class implementation automatically.

Methods

    public bool CanInstance()

Returns true if the script can be instanced.

    public Script GetBaseScript()

Returns the script directly inherited by this script.

    public string GetInstanceBaseType()

Returns the script’s base type.

    public string GetSourceCode()

Getter for SourceCode

    public bool HasScriptSignal(string signalName)

Returns true if the script, or a base class, defines a signal with the given name.

    public bool HasSourceCode()

Returns true if the script contains non-empty source code.

    public bool InstanceHas(Object baseObject)

Returns true if baseObject is an instance of this script.

    public bool IsTool()

Returns true if the script is a tool script. A tool script can run in the editor.

    public Error Reload(bool keepState = false)

Reloads the script’s class implementation. Returns an error code.

    public void SetSourceCode(string source)

Setter for SourceCode

Tags: