An asset that describes how visual objects should appear. Each Material is a collection of Passes which define the actual rendering passes. Materials are used by MeshVisuals for drawing meshes in the scene.

// Gets the first pass of a material on a sprite and plays the animation from its texture
var sprite = script.getSceneObject().getFirstComponent("Component.SpriteVisual");
var material = sprite.getMaterial(0);
material.getPass(0).baseTex.control.play(-1,0.0);

// Print number of passes
print("Pass count = " + material.getPassCount().toString());
interface Material {
    mainPass: Pass;
    name: string;
    uniqueIdentifier: string;
    clone(): Material;
    getPass(index: number): Pass;
    getPassCount(): number;
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
}

Hierarchy (view full)

Properties

mainPass: Pass

The first Pass of the Material.

name: string

The name of the Asset in Lens Studio.

uniqueIdentifier: string

Methods

  • Returns the Pass of the Material at index index.

    Parameters

    • index: number

    Returns Pass

  • Returns the number of Passes for the Material.

    Returns number

  • Returns the name of this object's type.

    Returns string

  • Returns true if the object matches or derives from the passed in type.

    Parameters

    • type: string

    Returns boolean

  • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

    Parameters

    Returns boolean