Documentation
¶
Overview ¶
Package Script provides methods for working with Script object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsScript() Instance
- func (self Instance) CanInstantiate() bool
- func (self Instance) GetBaseScript() [1]gdclass.Script
- func (self Instance) GetGlobalName() string
- func (self Instance) GetInstanceBaseType() string
- func (self Instance) GetPropertyDefaultValue(property string) any
- func (self Instance) GetScriptConstantMap() map[string]interface{}
- func (self Instance) GetScriptMethodList() []PropertyInfo
- func (self Instance) GetScriptPropertyList() []PropertyInfo
- func (self Instance) GetScriptSignalList() []SignalInfo
- func (self Instance) HasScriptSignal(signal_name string) bool
- func (self Instance) HasSourceCode() bool
- func (self Instance) InstanceHas(base_object Object.Instance) bool
- func (self Instance) IsAbstract() bool
- func (self Instance) IsTool() bool
- func (self Instance) Reload() error
- func (self Instance) SetSourceCode(value string)
- func (self Instance) SourceCode() string
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type PropertyInfo
- type SignalInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Instance ¶
A class stored as a resource. A script extends the functionality of all objects that instantiate it. This is the base class for all scripts and should not be used directly. Trying to create a new script with this class will result in an error. The [code]new[/code] method of a script subclass creates a new instance. [method Object.set_script] extends an existing object, if that object's class matches one of the script's base classes.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) CanInstantiate ¶
Returns [code]true[/code] if the script can be instantiated.
func (Instance) GetBaseScript ¶
Returns the script directly inherited by this script.
func (Instance) GetGlobalName ¶
Returns the class name associated with the script, if there is one. Returns an empty string otherwise. To give the script a global name, you can use the [code]class_name[/code] keyword in GDScript and the [code][GlobalClass][/code] attribute in C#. [codeblocks] [gdscript] class_name MyNode extends Node [/gdscript] [csharp] using Godot;
[GlobalClass] public partial class MyNode : Node { } [/csharp] [/codeblocks]
func (Instance) GetInstanceBaseType ¶
Returns the script's base type.
func (Instance) GetPropertyDefaultValue ¶
Returns the default value of the specified property.
func (Instance) GetScriptConstantMap ¶
Returns a dictionary containing constant names and their values.
func (Instance) GetScriptMethodList ¶
func (self Instance) GetScriptMethodList() []PropertyInfo
Returns the list of methods in this [Script].
func (Instance) GetScriptPropertyList ¶
func (self Instance) GetScriptPropertyList() []PropertyInfo
Returns the list of properties in this [Script].
func (Instance) GetScriptSignalList ¶
func (self Instance) GetScriptSignalList() []SignalInfo
Returns the list of user signals defined in this [Script].
func (Instance) HasScriptSignal ¶
Returns [code]true[/code] if the script, or a base class, defines a signal with the given name.
func (Instance) HasSourceCode ¶
Returns [code]true[/code] if the script contains non-empty source code. [b]Note:[/b] If a script does not have source code, this does not mean that it is invalid or unusable. For example, a [GDScript] that was exported with binary tokenization has no source code, but still behaves as expected and could be instantiated. This can be checked with [method can_instantiate].
func (Instance) InstanceHas ¶
Returns [code]true[/code] if [param base_object] is an instance of this script.
func (Instance) IsAbstract ¶
Returns [code]true[/code] if the script is an abstract script. An abstract script does not have a constructor and cannot be instantiated.
func (Instance) IsTool ¶
Returns [code]true[/code] if the script is a tool script. A tool script can run in the editor.
func (Instance) SetSourceCode ¶
func (Instance) SourceCode ¶
func (*Instance) UnsafePointer ¶
type PropertyInfo ¶
type SignalInfo ¶
type SignalInfo struct { Name string `gd:"name"` Flags int `gd:"flags"` ID int `gd:"id"` DefaultArgs []interface{} `gd:"default_args"` Args []PropertyInfo `gd:"args"` }