Skip to main content

MetaField

                            
                              
                                class 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                       extends 
                                      TSerializedValue
                                       = 
                                      TSerializedValue
                                    
                                  
                                
                              
                              

Represents an entry in the meta file.

Type Parameters

  • TSerializedValue

    The type used to store this field in the metafile.

  • TValue extends TSerializedValue = TSerializedValue

    The runtime type of this field.

Extended by

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

Constructors

constructor

                            
                              
                                public 
                                new
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                       = 
                                      TSerializedValue
                                    
                                  
                                
                                
                                  
                                    
                                      name
                                      : 
                                      string
                                    
                                    
                                      initial
                                      : 
                                      TValue
                                    
                                  
                                
                                : 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                    
                                  
                                
                              
                              

Type Parameters

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.

Events

onChanged

                            
                              
                                public 
                                get 
                                onChanged
                                (): 
                                SubscribableValueEvent
                                
                                  
                                    
                                      TValue
                                    
                                  
                                
                              
                              

Triggered when the data of this field changes.


onDisabled

                            
                              
                                public 
                                get 
                                onDisabled
                                (): 
                                SubscribableValueEvent
                                
                                  
                                    
                                      boolean
                                    
                                  
                                
                              
                              

Triggered when the field becomes disabled or enabled.

Methods

clone

                            
                              
                                public 
                                clone
                                (): 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                    
                                  
                                
                              
                              

Create a clone of this field.


describe

                            
                              
                                public 
                                describe
                                
                                  
                                    
                                      description
                                      : 
                                      string
                                    
                                  
                                
                                : 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                    
                                  
                                
                              
                              

Set the description of this field.

Parameters


disable

                            
                              
                                public 
                                disable
                                
                                  
                                    
                                      value
                                      : 
                                      boolean
                                       = 
                                      true
                                    
                                  
                                
                                : 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                    
                                  
                                
                              
                              

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 
                                parse
                                
                                  
                                    
                                      value
                                      : 
                                      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 
                                set
                                
                                  
                                    
                                      value
                                      : 
                                      TSerializedValue
                                    
                                  
                                
                                : 
                                void
                              
                              

Set the current value.

Parameters

  • value : TSerializedValue

    The new value.


space

                            
                              
                                public 
                                space
                                
                                  
                                    
                                      value
                                      : 
                                      boolean
                                       = 
                                      true
                                    
                                  
                                
                                : 
                                MetaField
                                
                                  
                                    
                                      TSerializedValue
                                    
                                    
                                      TValue
                                    
                                  
                                
                              
                              

Add or remove spacing at the beginning of this field.

Parameters

  • value : boolean = true

    Whether to include the spacing.