API reference

EffectMesh Class

Extends MonoBehaviour
Manages dynamic mesh and collider generation based on scene elements.
This class is responsible for creating and managing the anchor's rendering and their associated colliders within a scene. It allows for dynamic updates based on scene changes, such as room and anchor updates, and provides options for shadow casting, visibility, and material customization. EffectMeshObject is used to represent the generated objects.

Fields

BorderSize : float
Signature
float BorderSize
Colliders : bool
If enabled, a BoxCollider will be generated for each mesh component or a MeshCollider if the anchor has a triangle mesh.
Signature
bool Colliders
Cut holes in the mesh for door frames and/or window frames.
NOTE: This does not apply if border size is non-zero
Signature
MRUKAnchor.SceneLabels CutHoles
Signature
MRUKAnchor.SceneLabels Labels
Layer : int
Signature
int Layer
MeshMaterial : Material
The material applied to the generated mesh.
If you'd like a multi-material room, you can use another EffectMesh object with a different Mesh Material.
Signature
Material MeshMaterial
SpawnOnStart : MRUK.RoomFilter
When the scene data is loaded, this controls what room(s) the effect mesh is applied to.
See MRUK.RoomFilter for more details.
Signature
MRUK.RoomFilter SpawnOnStart
textureCoordinateModes : TextureCoordinateModes[]
Signature
TextureCoordinateModes [] textureCoordinateModes

Properties

CastShadow : bool
[Get][Set]
Gets or sets a value indicating whether the effect mesh objects should cast shadows.
true if effect mesh objects should cast shadows; otherwise, false.
Signature
bool CastShadow
EffectMeshObjects : IReadOnlyDictionary< MRUKAnchor, EffectMeshObject >
[Get]
Gets a dictionary that maps MRUKAnchor instances to their corresponding spawned EffectMeshObject.
This should be treated as read-only, do not modify the contents.
Signature
IReadOnlyDictionary<MRUKAnchor, EffectMeshObject> EffectMeshObjects
HideMesh : bool
[Get][Set]
Gets or sets a value indicating whether the effect mesh objects should be hidden.
true if effect mesh objects should be hidden; otherwise, false.
Signature
bool HideMesh
ToggleColliders : bool
[Get][Set]
Gets or sets a value indicating whether colliders for the effect mesh objects should be active.
true if colliders for effect mesh objects should be active; otherwise, false.
Signature
bool ToggleColliders

Methods

AddColliders ( label )
Adds colliders to the mesh objects instantiated based on the provided label filter.
Signature
void AddColliders(LabelFilter label=new LabelFilter())
Parameters
label: LabelFilter  The filter to determine which mesh objects receive a collider. If a mesh object's anchor labels pass this filter and the mesh object does not already have a collider, a new collider is added. Default value includes all labels.
Returns
void
CreateEffectMesh ( anchorInfo )
Creates an effect mesh for a specified anchor using the default border size.
Signature
EffectMeshObject CreateEffectMesh(MRUKAnchor anchorInfo)
Parameters
anchorInfo: MRUKAnchor  The anchor information used to create the effect mesh.
Returns
EffectMeshObject  An instance of EffectMeshObject representing the created effect mesh or null if the mesh could not be created.
CreateMesh ()
Creates effect mesh for all elements in all rooms.
Signature
void CreateMesh()
Returns
void
CreateMesh ( room )
Creates effect mesh for all objects in the given room.
Signature
void CreateMesh(MRUKRoom room)
Parameters
room: MRUKRoom  The room to apply to
Returns
void
DestroyColliders ( label )
Destroy the colliders of the instantiated mesh objects based on the provided label filter.
Signature
void DestroyColliders(LabelFilter label=new LabelFilter())
Parameters
label: LabelFilter  The filter to determine which mesh objects receive a collider. If a mesh object's anchor labels pass this filter and the mesh object does not already have a collider, a new collider is added. Default value includes all labels.
Returns
void
DestroyMesh ( label )
Destroys mesh the objects instantiated based on the provided label filter.
Signature
void DestroyMesh(LabelFilter label=new LabelFilter())
Parameters
label: LabelFilter  The filter for mesh object destruction. If a mesh object's anchor labels pass this filter, the mesh object will be destroyed. Default value includes all labels.
Returns
void
DestroyMesh ( room )
Destroys all meshs in the given room and mark the room as not tracked anymore by this class.
Signature
void DestroyMesh(MRUKRoom room)
Parameters
room: MRUKRoom  MRUK Room
Returns
void
DestroyMesh ( anchor )
Destroys the meshs associated with the provided anchor and mark the anchor as not tracked anymore by this class.
Signature
void DestroyMesh(MRUKAnchor anchor)
Parameters
anchor: MRUKAnchor  MRUK Anchor
Returns
void
OverrideEffectMaterial ( newMaterial , label )
Overrides the material of the effect mesh objects instantiated based on the provided label filter.
Signature
void OverrideEffectMaterial(Material newMaterial, LabelFilter label=new LabelFilter())
Parameters
newMaterial: Material  The new material to apply to the effect mesh objects.
label: LabelFilter  The filter to determine which effect mesh objects have their material overridden. If an effect mesh object's anchor labels pass this filter, its material is changed to the new material. Default value is a new instance of LabelFilter.
Returns
void
SetEffectObjectsParent ( newParent )
Utility function that sets the parent transform for all effect mesh objects managed by this class.
Signature
void SetEffectObjectsParent(Transform newParent)
Parameters
newParent: Transform  The new parent transform to which all effect mesh objects will be attached.
Returns
void
ToggleEffectMeshColliders ( doEnable , label )
Toggles the colliders of the effect mesh objects.
Creates one if not existing.
Signature
void ToggleEffectMeshColliders(bool doEnable, LabelFilter label=new LabelFilter())
Parameters
doEnable: bool  Determines whether the effect mesh objects should have an active collider or not.
label: LabelFilter  The filter to determine which effect mesh objects have their visibility toggled. If an effect mesh object's anchor labels pass this filter, its visibility is toggled according to the 'shouldShow' parameter. Default value includes all labels.
Returns
void
ToggleEffectMeshVisibility ( shouldShow , label , materialOverride )
Toggles the visibility of the effect mesh objects instantiated based on the provided label filter.
Signature
void ToggleEffectMeshVisibility(bool shouldShow, LabelFilter label=new LabelFilter(), Material materialOverride=null)
Parameters
shouldShow: bool  Determines whether the effect mesh objects should be visible or not.
label: LabelFilter  The filter to determine which effect mesh objects have their visibility toggled. If an effect mesh object's anchor labels pass this filter, its visibility is toggled according to the 'shouldShow' parameter. Default value includes all labels.
materialOverride: Material  An optional material to apply to the effect mesh objects when their visibility is toggled. If not provided, the material of the mesh objects remains unchanged.
Returns
void
ToggleShadowCasting ( shouldCast , label )
Toggles the shadow casting behavior of effect mesh objects based on the specified label filter.
Signature
void ToggleShadowCasting(bool shouldCast, LabelFilter label=new LabelFilter())
Parameters
shouldCast: bool  Determines whether shadows should be cast by the effect mesh objects.
label: LabelFilter  A filter that specifies which effect mesh objects should have their shadow casting toggled. The default is a new instance of LabelFilter, which includes all labels.
Returns
void

Inner Classes

EffectMeshObject Class

Represents an object that holds the components necessary for an effect mesh.
Encapsulates the GameObject, Mesh, and Collider components used to create and manage effect meshes. Is used to store and access the generated EffectMesh and collider components.

Fields

collider : Collider
The Collider component associated with the effect mesh object.
Can be a BoxCollider or a MeshCollider. Could be null if EffectMesh.Colliders was set to false.
Signature
Collider collider
effectMeshGO : GameObject
The GameObject associated with the effect mesh object.
Makes it easier to access the transform and other components.
Signature
GameObject effectMeshGO
mesh : Mesh
The Mesh component associated with the effect mesh.
This component holds the mesh data generated by the EffectMesh.
Signature
Mesh mesh

TextureCoordinateModes Class

Represents the texture coordinate modes for walls and anchors and defines how texture coordinates are calculated for different surfaces based on specified modes.
See WallTextureCoordinateModeU, WallTextureCoordinateModeV, and AnchorTextureCoordinateMode for more details.

Fields

Specifies the texture coordinate mode for anchor surfaces.
  • METRIC: The texture coordinates start at 0 and increase by 1 unit every meter.
  • STRETCH: The texture coordinates range from 0 to 1 across the anchor surface.
Signature
AnchorTextureCoordinateMode AnchorUV
Specifies the texture coordinate mode for the U-axis of wall texture.
To achieve seamless textures that highlight each wall the WallTextureCoordinateModeU should be set to WallTextureCoordinateModeU.STRETCH_SECTION
  • METRIC: The texture coordinates start at 0 and increase by 1 unit every meter.
  • METRIC_SEAMLESS: The texture coordinates start at 0 and increase by 1 unit every meter but are adjusted to end on a whole number to avoid seams.
  • MAINTAIN_ASPECT_RATIO: The texture coordinates are adjusted to the V dimensions to ensure the aspect ratio is maintained.
  • MAINTAIN_ASPECT_RATIO_SEAMLESS: The texture coordinates are adjusted to the V dimensions to ensure the aspect ratio is maintained but are adjusted to end on a whole number to avoid seams.
  • STRETCH: The texture coordinates range from 0 to
    1. STRETCH_SECTION: The texture coordinates start at 0 and increase to 1 for each individual wall section.
    Signature
    WallTextureCoordinateModeU WallU
    Specifies the texture coordinate mode for the V-axis of wall textures.
    To achieve seamless textures that highlight each wall the WallTextureCoordinateModeV should be set to WallTextureCoordinateModeV.STRETCH_SECTION
    • METRIC: The texture coordinates start at 0 and increase by 1 unit every meter.
    • METRIC_SEAMLESS: The texture coordinates start at 0 and increase by 1 unit every meter but are adjusted to end on a whole number to avoid seams.
    • MAINTAIN_ASPECT_RATIO: The texture coordinates are adjusted to the U dimensions to ensure the aspect ratio is maintained.
    • MAINTAIN_ASPECT_RATIO_SEAMLESS: The texture coordinates are adjusted to the U dimensions to ensure the aspect ratio is maintained but are adjusted to end on a whole number to avoid seams.
    • STRETCH: The texture coordinates range from 0 to
      1. STRETCH_SECTION: The texture coordinates start at 0 and increase to 1 for each individual wall section.
      Signature
      WallTextureCoordinateModeV WallV

      Inner Enums

      WallTextureCoordinateModeU Enum

      Defines the modes for calculating texture coordinates along the U-axis (horizontal) for wall textures.

      Enumeration Constants

      Member
      METRIC
      METRIC_SEAMLESS
      MAINTAIN_ASPECT_RATIO
      MAINTAIN_ASPECT_RATIO_SEAMLESS
      STRETCH
      STRETCH_SECTION

      WallTextureCoordinateModeV Enum

      Defines the modes for calculating texture coordinates along the V-axis (vertical) for wall textures.

      Enumeration Constants

      Member
      METRIC
      MAINTAIN_ASPECT_RATIO
      STRETCH

      AnchorTextureCoordinateMode Enum

      Defines the modes for calculating texture coordinates for anchor surfaces.

      Enumeration Constants

      Member
      METRIC
      STRETCH