Skip to content
Untitled Sandbox - Developer Documentation
docs/api/prefabs

@usbx/prefabs

List prefabs and read their size

local prefabs = require("@usbx/prefabs")

prefabs.list

function

The names of the prefabs of the place.

prefabs.list() -> { string }
example
for _, name in prefabs.list() do print(name) end

Use it forfilling a build menu or a random spawner with the name of every prefab in the place.

prefabs.info

function

What a prefab holds and its size. Nil if the place has no prefab with the name.

prefabs.info(name: string) -> PrefabInfo?
example
local car = prefabs.info("Car")

Use it forchecking how big a vehicle prefab is before spawning it, so it fits in the garage.

nameName of a prefab of the place.

prefabs.exists

function

Whether the place has a prefab with the name.

prefabs.exists(name: string) -> boolean
example
if prefabs.exists("Car") then print("the place has a Car") end

Use it forchecking that a prefab is there before you spawn it, so a missing one does not cause an error.

nameName of a prefab of the place.
↑ ↓ moveEnter openEsc close