Material
Lens Studio v1.0.0+
Scripting Name: Asset.Material
Inherits from Asset
Description
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.
Methods
clone()
: Material
Returns a copy of the Material.
getPass(Number index)
: Pass
Returns the Pass of the Material at index index
.
getPassCount()
: Number
Returns the number of Passes for the Material.
Properties
mainPass
: Pass
The first Pass of the Material.
Inherited Methods
isSame(SerializableWithUID other)
: Boolean
Returns true if this object is the same as other
. Useful for checking if two references point to the same thing.
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Inherited Properties
name
: String
The name of the Asset in Lens Studio.
Examples
// 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());
Still Looking for help?
Visit Support