API reference

DestructibleGlobalMeshSpawner Class

Extends MonoBehaviour
The DestructibleGlobalMeshSpawner class manages the spawning and lifecycle of destructible global meshes within the MRUK framework.
It listens to room events and dynamically creates or removes destructible meshes as rooms are created or removed. For more details on room management, see MRUKRoom.

Fields

CreateOnRoomLoaded : MRUK.RoomFilter
Signature
MRUK.RoomFilter CreateOnRoomLoaded
OnDestructibleMeshCreated : UnityEvent< DestructibleMeshComponent >
Event triggered when a destructible mesh is successfully created.
Signature
UnityEvent<DestructibleMeshComponent> OnDestructibleMeshCreated
OnSegmentationCompleted : Func< DestructibleMeshComponent.MeshSegmentationResult, DestructibleMeshComponent.MeshSegmentationResult >
Function delegate that processes the segmentation result.
It can be used to modify the segmentation results before they are instantiated.
Signature
Func<DestructibleMeshComponent.MeshSegmentationResult, DestructibleMeshComponent.MeshSegmentationResult> OnSegmentationCompleted

Properties

GlobalMeshMaterial : Material
[Get][Set]
Gets or sets the material used for the mesh.
This material is applied to the mesh segments that are created during the segmentation process.
Signature
Material GlobalMeshMaterial
MaxPointsCount : int
[Get][Set]
Gets or sets the maximum number of points that the destructible mesh can contain.
The higher number of points the higher the impact on performance
Signature
int MaxPointsCount
PointsPerUnitX : float
[Get][Set]
Gets or sets the number of points per unit along the X-axis for the destructible mesh.
This setting affects the density and detail of the mesh, influencing both visual quality and performance.
Signature
float PointsPerUnitX
PointsPerUnitY : float
[Get][Set]
Gets or serts the number of points per unit along the Y-axis for the destructible mesh.
This setting affects the density and detail of the mesh, influencing both visual quality and performance.
Signature
float PointsPerUnitY
ReservedBottom : float
[Get][Set]
Gets or sets the reserved space at the bottom of the mesh.
TThis space is not included in the destructible area, allowing for controlled segmentation.
Signature
float ReservedBottom
ReservedTop : float
[Get][Set]
Gets or sets the reserved space at the top of the mesh.
This space is not included in the destructible area, allowing for controlled segmentation.
Signature
float ReservedTop
ReserveSpace : bool
[Get][Set]
Gets or sets whether to keep some reserved un-destructible space (defined in meters).
Signature
bool ReserveSpace

Methods

AddDestructibleGlobalMesh ( room )
Adds a destructible global mesh to a specific room.
This method checks for existing meshes in the room and creates a new one if none exists. The destructible mesh is created using the specified parameters, including the material, points per unit, and maximum points count. A DestructibleMeshComponent is added to the destructible global mesh game object, and the segmentation process is started.
Signature
DestructibleGlobalMesh AddDestructibleGlobalMesh(MRUKRoom room)
Parameters
room: MRUKRoom  The room to which the mesh will be added.
Returns
DestructibleGlobalMesh  The destructible mesh created for the room.
RemoveDestructibleGlobalMesh ( room )
Removes a destructible global mesh from the specified room.
If no room is specified, it defaults to the current room.
Signature
void RemoveDestructibleGlobalMesh(MRUKRoom room=null)
Parameters
room: MRUKRoom  The room from which the mesh will be removed. If null, the current room is used.
Returns
void
TryGetDestructibleMeshForRoom ( room , destructibleGlobalMesh )
Attempts to find a destructible mesh associated with a specific room.
If found, the method returns true and provides the mesh via an out parameter.
Signature
bool TryGetDestructibleMeshForRoom(MRUKRoom room, out DestructibleGlobalMesh destructibleGlobalMesh)
Parameters
room: MRUKRoom  The room for which to find the destructible mesh.
destructibleGlobalMesh: out DestructibleGlobalMesh  Out parameter that will hold the destructible mesh if found.
Returns
bool  False if the mesh is not found (i.e., default value is returned), otherwise true.