Lens Scripting API

    Class ObjectPrefab

    Represents reusable SceneObject hierarchy stored as a resource.

    Can be instantiated through script or brought into the scene by dragging from Asset Browser to Scene Hierarchy panel.

    Prefabs guide.

    // Instantiate a prefab under a parent scene object
    // @input Asset.ObjectPrefab prefab
    // @input SceneObject parentObject
    var newObject = script.prefab.instantiate(script.parentObject);
    print("Prefab Instantiated: " + newObject.name);

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    name: string

    The name of the Asset in Lens Studio.

    uniqueIdentifier: string

    Methods

    • Returns the name of this object's type.

      Returns string

    • Creates and returns a new instance of this object hierarchy underneath the specified parent object. If parent is null, the object will be created with no parent.

      Parameters

      Returns SceneObject

    • Instantiate a prefab asynchronously.

      Parameters

      • parent: SceneObject
      • onSuccess: (sceneObject: SceneObject) => void
      • onFailure: (error: string) => void
      • onProgress: (progress: number) => void

      Returns void

    • 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

    MMNEPVFCICPMFPCPTTAAATR