Builtin Library
- ..
- .metadata175 B
- README.md1.2 KB
- guid.module
- init.luau1.6 KB
README.md
prefab.from_asset (procNode)
A prefab: a root plus one child carrying a durable asset reference as an Asset component. The asset's own type decides what the child becomes when it instantiates (a landscape stands a Terrain entity, a bundle its hierarchy, a mesh a Model). Use it to place an asset an export node saved, or any asset by its identity.
The child's Asset component holds the asset's guid as source, so the prefab follows the asset's current content. A value that is not an asset reference (a bare string, a number) is an error naming what was given.
Inputs
asset(AssetRef). A reference to a durable asset:asset.resolve("<identity>", "<type>")or an export node's output. The child references it by guid, so the prefab follows the asset's current content.name(String, default "asset"). The root entity's name; the single child carrying the reference is named<name>_asset. An empty string takes "asset".
Outputs
prefab(Prefab). Two records: the root (id "0") and the child (id "1").
local rock = g.prefab.from_asset({ asset = asset.resolve("@builtin::meshes.cube", "mesh"), name = "rock" })