Click or drag to resize

Type and Metadata Programming

Event HandlersManual / Advanced / Type and Metadata ProgrammingAdd-on Creation

Type and Metadata Programming

Contents
Overview

The architecture of the engine allows you to work with object types at an advanced level. You can create complex objects, then use it as types. That gives the ability in a visual manner to create types, create an inheritance of types, attaching nested components to the component hierarchy, adding virtual properties and other features. It's similar to object-oriented programming, but for resources.

Save to file

A first simple action with types is the ability to save the component hierarchy into a separate file. Use 'Export to File' context menu item to do it. Next, the resource can be used as a type.

Screenshot999999999999999999052.png
Screenshot999999999999999999053 2.png
Use nested components of resources

Another way it is using resources as containers of types. For example, select your scene file, press '+' to see the objects of the scene.

Screenshot999999999999999999048 2.png

Find objects by name.

Screenshot999999999999999999049 2.png

And drop the objects to another scene.

Screenshot999999999999999999051 2.png
Metadata programming

You can add virtual properties and virtual methods to any objects.

Also, event handlers can be used to expand functionality of objects.

Type Settings form

The editor allows customizing the hiding of properties and nested objects. This is done using the Type Settings form, which can be opened via clicking the button in the upper right corner of the Settings Window.

Screenshot999999542 2.png

Opened form.

Screenshot999999543.png

On the examples 'Material base.material' and 'Material inheritance.scene' you can see how it works. Files are in 'Assets\Samples\Starter Content\Scenes\Material inheritance'. The example demonstrates the inheritance of materials, the hiding of properties, the use of virtual properties.

The file 'Material base.material' is a material that has the virtual property Color added. All other properties and 'Shader graph' attached object are hidden using the Type Settings form.

Screenshot999999544 2.png

The file 'Material inheritance.material' is an example of using the material. As you can see, only the Color property is available. There are no other properties, as there is no nested 'Shader graph'. Along the way, an example demonstrates the possibilities of instancing of materials.

Screenshot999999545 2.png
See also
Event HandlersAdd-on Creation