Skip to content

Prefab โ€‹

Prefabs are pre-designed voxel models that are stored in Prefab Packages. They can be loaded into VoxelLayer nodes using FxVoxelLayer.LoadPrefab.

To change the voxels of a Prefab use FxVoxelLayer.SavePrefab.

Properties โ€‹

NameTypeDefaultAccessDescription
category1i0๐ŸŸฉ๐ŸŸฅCategory
description1s๐ŸŸฉ๐ŸŸฅMetadata, description
guid1s๐ŸŸฉโŒGlobally unique identifier
headline1s๐ŸŸฉ๐ŸŸฅMetadata, headline
keywords1s๐ŸŸฉ๐ŸŸฅMetadata, keyword
size3i๐ŸŸฉโŒVoxel grid size
title1s๐ŸŸฉ๐ŸŸฅMetadata, title
unitScale1f1.0๐ŸŸฉ๐ŸŸฅUnit scale
Details

Type
1b: boolean
1c: color (integer)
1i: integer
1f: float
1s: string
2b: 2-component boolean vector
2i: 2-component integer vector
2f: 2-component float vector
3b: 3-component boolean vector
3i: 3-component integer vector
3f: 3-component float vector

Access
๐ŸŸฉ : Property value can be read with FxFile.Get
๐ŸŸฅ : Property value can be changed with FxFile.Set
โŒ : Property value is read-only and can't be changed

Create โ€‹

To create a new prefab in the open prefab package use FxFile.Create with FileType 444.

lua
FxFile.Open(445, "MyPackage") -- open target prefab package first
prefabID = FxFile.Create(444); -- create prefab
prefabID = FxFile.Rename(444, prefabID, "MyPrefab"); -- rename new prefab
FxFile.Open(444, prefabID) -- open prefab