Script
A class stored as a resource.
A class stored as a resource.
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 new method of a script subclass creates a new instance. ReckfellObject.SetScript extends an existing object, if that object's class matches one of the script's base classes.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Properties1
SourceCodeProperty
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.
Methods19
CanInstantiatebool
public bool CanInstantiate();Returns true if the script can be instantiated.
boolGetBaseScriptScript
public Script GetBaseScript();Returns the script directly inherited by this script.
ScriptGetGlobalNameStringName
public StringName 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 class_name keyword in C# and the GlobalClass attribute in C#.
using Reckfell;
[GlobalClass]
public partial class MyNode : Entity
{
}StringNameGetInstanceBaseTypeStringName
public StringName GetInstanceBaseType();Returns the script's base type.
StringNameGetPropertyDefaultValueVariant
public Variant GetPropertyDefaultValue(StringName property);Returns the default value of the specified property.
Note: In C# and C#, this method returns null outside of editor builds.
| Name | Type | Default |
|---|---|---|
property | StringName | — |
VariantGetRpcConfigVariant
public Variant GetRpcConfig();Returns a Reckfell.Collections.Dictionary mapping method names to their RPC configuration defined by this script.
VariantGetScriptConstantMapReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary GetScriptConstantMap();Returns a dictionary containing constant names and their values.
Reckfell.Collections.DictionaryGetScriptMethodListReckfell.Collections.Array<Reckfell.Collections.Dictionary>
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetScriptMethodList();Returns the list of methods in this Script.
Note: The dictionaries returned by this method are formatted identically to those returned by ReckfellObject.GetMethodList.
Reckfell.Collections.Array<Reckfell.Collections.Dictionary>GetScriptPropertyListReckfell.Collections.Array<Reckfell.Collections.Dictionary>
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetScriptPropertyList();Returns the list of properties in this Script.
Note: The dictionaries returned by this method are formatted identically to those returned by ReckfellObject.GetPropertyList.
Reckfell.Collections.Array<Reckfell.Collections.Dictionary>GetScriptSignalListReckfell.Collections.Array<Reckfell.Collections.Dictionary>
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetScriptSignalList();Returns the list of signals defined in this Script.
Note: The dictionaries returned by this method are formatted identically to those returned by ReckfellObject.GetSignalList.
Reckfell.Collections.Array<Reckfell.Collections.Dictionary>GetSourceCodestring
public string GetSourceCode();stringHasScriptMethodbool
public bool HasScriptMethod(StringName methodName);Returns true if the script, or a base class, defines a method with the given name.
| Name | Type | Default |
|---|---|---|
methodName | StringName | — |
boolHasScriptSignalbool
public bool HasScriptSignal(StringName signalName);Returns true if the script, or a base class, defines a signal with the given name.
| Name | Type | Default |
|---|---|---|
signalName | StringName | — |
boolHasSourceCodebool
public bool HasSourceCode();Returns true if the script contains non-empty source code.
Note: If a script does not have source code, this does not mean that it is invalid or unusable. For example, a Script.CanInstantiate.
boolInstanceHasbool · Deprecated
public bool InstanceHas(ReckfellObject baseObject);Returns true if base_object is an instance of this script.
| Name | Type | Default |
|---|---|---|
baseObject | ReckfellObject | — |
boolIsAbstractbool
public bool IsAbstract();Returns true if the script is an abstract script. An abstract script does not have a constructor and cannot be instantiated.
boolIsToolbool
public bool IsTool();Returns true if the script is a tool script. A tool script can run in the editor.
boolReloadError
public Error Reload(bool keepState = false);Reloads the script's class implementation. Returns an error code.
| Name | Type | Default |
|---|---|---|
keepState | bool | false |
ErrorSetSourceCodevoid
public void SetSourceCode(string source);| Name | Type | Default |
|---|---|---|
source | string | — |