Skip to main content

Editor.Assets.ScriptAsset

Class

Script asset that can be attached to scene objects, containing inputs, attachments, and metadata.

Index

Example

///@input string stringToPrint = "Print this on Tap"
//@input int testIntProperty = 7
//@input int[] testIntArray = {1, 2, 3}

scriptAsset.stringToPrint = "New String";
scriptAsset.testIntProperty = 9;
scriptAsset.testIntArray = [4,5,6];

// set icon
const buffer = Editor.FileSystem.readTextAll(path to svg file)
const newIcon = Editor.Icon.setIconFromSVGData(buffer)
scriptAsset.icon = newIcon;
// getIcon
const icon = scriptAsset.icon

// set description
scriptAsset.description = "helloWorld"
// get description
const desc = scriptAsset.description

// hide input
scriptAsset.setScriptInputHidden("myInputName", true);

// unhide input
scriptAsset.setScriptInputHidden("myInputName", true);

// check visibility of input
scriptAsset.isScriptInputHidden("myInputName");

Extends

Extended by

Properties

attachments

attachments: Asset[]

Array of assets attached to this script.


cacheFile

readonly cacheFile: Path

Path to the cached asset file.

Inherited from

Asset.cacheFile


componentId

readonly componentId: Uuid

Id associated with the script asset.


declarationFile

declarationFile: ScriptAsset

TypeScript declaration file path for this script's type definitions.


description

description: string

Description associated with the script asset


exportId

readonly exportId: Uuid

Export id associated with the script asset.


fileMeta

readonly fileMeta: AssetImportMetadata

Import metadata for the asset.

Inherited from

Asset.fileMeta


icon

icon: Icon

Icon associated with the script asset.


id

readonly id: Uuid

The unique id of the entity.

Inherited from

Asset.id


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

Asset.meta


name

readonly name: string

The name of the asset.

Inherited from

Asset.name


readMe

readMe: MarkdownAsset

Documentation string for this script.


scriptType

scriptType: ScriptType

The kind of script this asset defines. See Editor.Assets.ScriptType.


tags

tags: string[]

Array of tags categorizing this script.


type

readonly type: string

The entity's type.

Inherited from

Asset.type


version

version: Version

Version associated with the script asset.

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

Asset.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

Asset.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

Asset.getOwnedEntities


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

Asset.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Asset.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Asset.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Asset.isSame


isScriptInputHidden()

isScriptInputHidden(inputName): boolean

Returns true if the script inpput is hidden from the scene.

Parameters

ParameterType
inputNamestring

Returns

boolean


setScriptInputHidden()

setScriptInputHidden(inputName, hidden): void

Used when you'd like to hide inputs from users in the scene.

Parameters

ParameterType
inputNamestring
hiddenboolean

Returns

void