Log inGet started

Material

The Material namespace — the engine's Luau API reference for Material.

The Material namespace — 14 functions.

globals/Material/Apply

globals/Material/Apply(entityId: string, materialRef: MaterialRefOrName) -> boolean

PascalCase back-compat alias for apply.

globals/Material/Create

globals/Material/Create(name: string, opts_or_shader: MaterialOpts | string | nil, props: MaterialOpts?) -> MaterialRef?

PascalCase back-compat alias for create. Accepts the legacy 3-arg form (name, shader_string, opts_table) by folding shader into opts, and the canonical 2-arg form (name, opts).

globals/Material/Exists

globals/Material/Exists(name: MaterialRefOrName) -> boolean

PascalCase back-compat alias for exists.

globals/Material/GetProperty

globals/Material/GetProperty(materialName: MaterialRefOrName, propertyName: string) -> any

PascalCase back-compat alias for getProperty.

globals/Material/GetPropertyNames

globals/Material/GetPropertyNames(materialName: MaterialRefOrName) -> { string }?

PascalCase back-compat alias for getPropertyNames.

globals/Material/SetProperty

globals/Material/SetProperty(materialName: MaterialRefOrName, property: string, value: any) -> any

PascalCase alias. Writes the property on the material ASSET by name/ref (persists into its mat.yaml, affecting every entity using it) — distinct from M.setProperty, which targets the material on one entity's model.

globals/Material/SetTexture

globals/Material/SetTexture(materialName: MaterialRefOrName, slot: string, textureRef: string) -> boolean

PascalCase back-compat alias for setTexture.

globals/Material/apply

globals/Material/apply(entity: any, materialRef: MaterialRefOrName) -> boolean

Apply a material to an entity's Model / SkinnedModel component by setting its material field. Accepts either an AssetRef envelope (from Material.create) or a bare material-name string. Errors when the entity has no Model or SkinnedModel — a material only renders where there is a mesh.

globals/Material/create

globals/Material/create(name: string, opts: MaterialOpts?) -> MaterialRef?

Create a named material in the MaterialRegistry. Returns the canonical AssetRef envelope ({ __ref, type="material", name, guid }) — pass directly to Material.apply, the Model / SkinnedModel material field, or any AssetRef<material> consumer.

globals/Material/exists

globals/Material/exists(name: MaterialRefOrName) -> boolean

Check whether a material exists in the registry. Accepts an AssetRef envelope or a bare material name.

globals/Material/getProperty

globals/Material/getProperty(materialName: MaterialRefOrName, propertyName: string) -> any

Read the current value of a material property.

globals/Material/getPropertyNames

globals/Material/getPropertyNames(materialName: MaterialRefOrName) -> { string }?

List the property names exposed by a registered material.

globals/Material/setProperty

globals/Material/setProperty(target: any, property: string, value: any)

Set a material property. Addresses the target the same way getProperty does: pass a material name / AssetRef to write the material ASSET (affecting every entity using it), or an entity proxy / id to write the material bound to that entity's Model / SkinnedModel. Errors when an entity target has no Model or SkinnedModel.

globals/Material/setTexture

globals/Material/setTexture(materialName: MaterialRefOrName, slot: string, textureRef: any) -> boolean

Set a texture slot on a named material.

  • api
  • reference