Skip to main content

MetaField

class MetaFieldTSerializedValueTValue extends TSerializedValue = TSerializedValue 

Represents an entry in the meta file.

Type Parameters

  • TSerializedValue

    The type used to store this field in the meta file.

  • TValue extends TSerializedValue = TSerializedValue

    The runtime type of this field.

Extended by

  • BoolMetaField
  • ColorMetaField
  • EnumMetaField
  • ExporterMetaField
  • NumberMetaField
  • RangeMetaField
  • StringMetaField
  • Vector2MetaField

Constructors

constructor

public new MetaFieldname: stringinitial: TValue: MetaFieldTSerializedValueTValue

Parameters

  • name: string

    The name of this field displayed in the editor.

  • initial: TValue

    The initial value of this field.

Properties

description

public description: string = ''

initial

readonly public initial: TValue

The initial value of this field.


name

readonly public name: string

The name of this field displayed in the editor.


spacing

public spacing: boolean = false

type

readonly public type: any = undefined

The type of this field used by the editor to display the correct input.

Methods

clone

public clone(): this

Create a clone of this field.


describe

public describedescription: string: this

Set the description of this field.

Parameters


disable

public disablevalue: boolean = true: this

Disable or enable the field in the editor.

Parameters

  • value: boolean = true

    Whether the field should be disabled.


get

public get(): TValue

Get the current value.


parse

public parsevalue: TSerializedValue: TValue

Convert a serialized value into a runtime type.

Parameters

  • value: TSerializedValue

    The serialized value.


serialize

public serialize(): TSerializedValue

Serialize the value of this field.


set

public setvalue: TSerializedValue: void

Set the current value.

Parameters

  • value: TSerializedValue

    The new value.


space

public spacevalue: boolean = true: this

Add or remove spacing at the beginning of this field.

Parameters

  • value: boolean = true

    Whether to include the spacing.

Events

onChanged

public get onChanged(): SubscribableValueEventTValue

Triggered when the data of this field changes.


onDisabled

public get onDisabled(): SubscribableValueEventboolean

Triggered when the field becomes disabled or enabled.