API reference

FindSpawnPositions Class

Extends MonoBehaviour
Allows for fast generation of valid (inside the room, outside furniture bounds) random positions for content spawning.
Optional method to pin directly to surfaces. This class leverages the MRUKRoom.GenerateRandomPositionInRoom and MRUKRoom.GenerateRandomPositionOnSurface methods to provide a simple interface for spawning content in the room.

Fields

CheckOverlaps : bool
If enabled then the spawn position will be checked to make sure there is no overlap with physics colliders including themselves.
Signature
bool CheckOverlaps
When using surface spawning, use this to filter which anchor labels should be included.
Eg, spawn only on TABLE or OTHER.
Signature
MRUKAnchor.SceneLabels Labels
LayerMask : LayerMask
Set the layer(s) for the physics bounding box checks, collisions will be avoided with these layers.
Signature
LayerMask LayerMask
MaxIterations : int
Maximum number of times to attempt spawning/moving an object before giving up.
Signature
int MaxIterations
OverrideBounds : float
Required free space for the object (Set negative to auto-detect using GetPrefabBounds) default to auto-detect.
This value represents the extents of the bounding box
Signature
float OverrideBounds
SpawnAmount : int
Number of SpawnObject(s) to place into the scene per room, only applies to Prefabs.
Signature
int SpawnAmount
SpawnLocations : SpawnLocation
Attach content to scene surfaces.
Signature
SpawnLocation SpawnLocations
SpawnObject : GameObject
Prefab to be placed into the scene, or object in the scene to be moved around.
Signature
GameObject SpawnObject
SpawnOnStart : MRUK.RoomFilter
When the scene data is loaded, this controls what room(s) the prefabs will spawn in.
Signature
MRUK.RoomFilter SpawnOnStart
SurfaceClearanceDistance : float
The clearance distance required in front of the surface in order for it to be considered a valid spawn position.
Signature
float SurfaceClearanceDistance

Methods

StartSpawn ()
Starts the spawning process for all rooms.
Signature
void StartSpawn()
Returns
void
StartSpawn ( room )
Starts the spawning process for a specific room.
A maximum of MaxIterations attempts will be made to find a valid spawn position. MRUKRoom.GenerateRandomPositionInRoom and MRUKRoom.GenerateRandomPositionOnSurface are used to generate the positions.
Signature
void StartSpawn(MRUKRoom room)
Parameters
room: MRUKRoom  The room to spawn objects in.
Returns
void

Inner Enum

SpawnLocation Enum

Defines possible locations where objects can be spawned.

Enumeration Constants

Member
Floating
AnySurface
VerticalSurfaces
OnTopOfSurfaces
HangingDown