_random
: Random |
Signature
Random _random |
onPrefabSpawned
: UnityEvent |
Event triggered when a prefab is spawned.
This event will be deprecated in a future version.
Signature
UnityEvent onPrefabSpawned |
PrefabsToSpawn
: List< AnchorPrefabGroup > |
The list of AnchorPrefabGroup configurations that determine how prefabs are spawned based on anchor data.
Signature
List<AnchorPrefabGroup> PrefabsToSpawn |
SeedValue
: int |
Specify a seed value for consistent prefab selection (0 = Random).
Signature
int SeedValue |
SpawnOnStart
: MRUK.RoomFilter |
"When the scene data is loaded, this controls what room(s) the prefabs will spawn in.
Signature
MRUK.RoomFilter SpawnOnStart |
AnchorPrefabSpawnerObjects
: Dictionary< MRUKAnchor, GameObject >
[Get] |
Gets a dictionary that maps MRUKAnchor instances to their corresponding spawned GameObjects.
This should be treated as read-only, do not modify the contents.
Signature
Dictionary<MRUKAnchor, GameObject> AnchorPrefabSpawnerObjects |
SpawnedPrefabs
: List< GameObject >
[Get] |
Use AnchorPrefabSpawnerObjects property instead.
Signature
List<GameObject> SpawnedPrefabs |
ClearPrefab
(
go
)
|
Destroys the specified GameObject, effectively removing the prefab from the scene and removing it from the AnchorPrefabSpawnerObjects dictionary.
Signature
virtual void ClearPrefab(GameObject go) Parameters go: GameObject
The GameObject to be destroyed.
Returns void |
ClearPrefab
(
anchorInfo
)
|
Clears the gameobject associated with the anchor.
Useful when receiving an event that a specific anchor has been removed
Signature
virtual void ClearPrefab(MRUKAnchor anchorInfo) Parameters Returns void |
ClearPrefabs
(
room
)
|
Clears all the previously spawned gameobjects from this AnchorPrefabSpawner instance in the given room.
Signature
virtual void ClearPrefabs(MRUKRoom room) Parameters Returns void |
ClearPrefabs
()
|
Clears all the gameobjects created by this AnchorPrefabSpawner instance for all rooms.
Signature
virtual void ClearPrefabs() Returns void |
ReceiveAnchorCreatedEvent
(
anchorInfo
)
|
Responds to the event of a new anchor being created within the scene.
This method triggers the spawning of prefabs if the anchor's room is being tracked and updates are enabled.
Signature
virtual void ReceiveAnchorCreatedEvent(MRUKAnchor anchorInfo) Parameters Returns void |
ReceiveAnchorRemovedCallback
(
anchorInfo
)
|
Responds to the event of an anchor being removed from the scene.
This method clears all prefabs spawned by this spawner.
Signature
virtual void ReceiveAnchorRemovedCallback(MRUKAnchor anchorInfo) Parameters Returns void |
ReceiveAnchorUpdatedCallback
(
anchorInfo
)
|
Responds to the event of an anchor being updated within the scene.
This method clears existing prefabs and triggers the spawning of new prefabs based on the updated anchor information, provided that updates are being tracked and the anchor or its parent room is not marked as untracked.
Signature
virtual void ReceiveAnchorUpdatedCallback(MRUKAnchor anchorInfo) Parameters Returns void |
ReceiveCreatedRoom
(
room
)
|
Responds to the event of a new room being created within the scene.
This method triggers the spawning of prefabs and registers for anchor updates within the room, provided that room updates are being tracked and the configuration is set to handle all rooms.
Signature
virtual void ReceiveCreatedRoom(MRUKRoom room) Parameters Returns void |
ReceiveRemovedRoom
(
room
)
|
Handles the event when a room is removed from the scene.
This method clears all prefabs associated with the room and unregisters updates for anchors within the room.
Signature
virtual void ReceiveRemovedRoom(MRUKRoom room) Parameters Returns void |
RegisterAnchorUpdates
(
room
)
|
Registers the anchor update events for a specific room.
This method starts listening for anchor creation, removal, and update events within the specified room.
Signature
virtual void RegisterAnchorUpdates(MRUKRoom room) Parameters Returns void |
SpawnPrefab
(
anchorInfo
)
|
Spawns a prefab based on the provided anchor information.
This method determines the appropriate prefab to spawn based on the anchor's label, checks for existing instances, and configures the spawned prefab's position, scale, and orientation according to the anchor's properties and predefined settings.
Signature
virtual void SpawnPrefab(MRUKAnchor anchorInfo) Parameters Returns void |
SpawnPrefabs
(
clearPrefabs
)
|
Spawns prefabs for all the rooms in the scene.
This method will iterate through all the rooms in the scene and spawn prefabs for each anchor in the room according to the AnchorPrefabGroup configuration of each label.
Signature
virtual void SpawnPrefabs(bool clearPrefabs=true) Parameters clearPrefabs: bool
Clear already existing prefabs before.
Returns void |
SpawnPrefabs
(
room
, clearPrefabs
)
|
Spawns prefabs for all the rooms in the scene.
This method will spawn prefabs for each anchor in the room according to the AnchorPrefabGroup configurations of each label.
Signature
virtual void SpawnPrefabs(MRUKRoom room, bool clearPrefabs=true) Parameters clearPrefabs: bool
clear all before adding them again
Returns void |
UnRegisterAnchorUpdates
(
room
)
|
Unregisters the anchor update events for a specific room.
This method stops listening for anchor creation, removal, and update events within the specified room.
Signature
virtual void UnRegisterAnchorUpdates(MRUKRoom room) Parameters Returns void |
CustomPrefabAlignment
(
anchorVolumeBounds
, prefabBounds
)
|
Custom logic for aligning a prefab within a volume.
Extend this class and override this method with your custom logic. All AnchorPrefabGroup with AlignMode set to Custom will use this method.
Signature
virtual Vector3 CustomPrefabAlignment(Bounds anchorVolumeBounds, Bounds? prefabBounds) Parameters anchorVolumeBounds: Bounds
The bounds of the anchor volume.
prefabBounds: Bounds?
The optional bounds of the prefab.
Returns Vector3
The adjusted position vector.
|
CustomPrefabAlignment
(
anchorPlaneRect
, prefabBounds
)
|
Custom logic for aligning a prefab within a plane rectangle.
Extend this class and override this method with your custom logic. All AnchorPrefabGroup with AlignMode set to Custom will use this method.
Signature
virtual Vector3 CustomPrefabAlignment(Rect anchorPlaneRect, Bounds? prefabBounds) Parameters anchorPlaneRect: Rect
The rectangle of the anchor plane.
prefabBounds: Bounds?
The optional bounds of the prefab.
Returns Vector3
The adjusted position vector.
|
CustomPrefabScaling
(
localScale
)
|
Custom logic for scaling a prefab's volume.
Extend this class and override this method with your custom logic. All AnchorPrefabGroup with ScalingMode set to Custom will use this method.
Signature
virtual Vector3 CustomPrefabScaling(Vector3 localScale) Parameters localScale: Vector3
The local scale vector.
Returns Vector3
The adjusted scale vector.
|
CustomPrefabScaling
(
localScale
)
|
Custom logic for scaling a prefab's plane rectangle.
Extend this class and override this method with your custom logic.
Signature
virtual Vector2 CustomPrefabScaling(Vector2 localScale) Parameters localScale: Vector2
The local scale vector.
Returns Vector2
The adjusted scale vector.
|
CustomPrefabSelection
(
anchor
, prefabs
)
|
Custom logic for selecting a prefab.
Extend this class and override this method with your custom logic. All AnchorPrefabGroup with SelectionMode set to Custom will use this method.
Signature
virtual GameObject CustomPrefabSelection(MRUKAnchor anchor, List< GameObject > prefabs) Parameters prefabs: List< GameObject >
The list of prefabs to choose from.
Returns GameObject
The selected prefab GameObject.
|
InitializeRandom
(
seed
)
|
Initializes a new instance of the Random class using the specified seed.
either the seed value or the current system tick count is used.
Signature
void InitializeRandom(ref int seed) Parameters seed: ref int
The seed value to initialize the random number generator. If zero, the seed will be set to the current system tick count.
Returns void |
Alignment
: AlignMode |
Spawn new object at the center, top, or bottom of the anchor.
This setting determines the vertical alignment of the spawned prefab.
Signature
AlignMode Alignment |
CalculateFacingDirection
: bool |
When calculate facing direction is enabled, the prefab will be rotated to face away from the closest wall.
If match aspect ratio is also enabled, that will take precedence and it will be constrained to a choice between 2 directions only. Only applies to volumes.
Signature
bool CalculateFacingDirection |
IgnorePrefabSize
: bool |
Don't analyze prefab, just assume a default scale of 1.
This setting simplifies the scaling process by using a default scale.
Signature
bool IgnorePrefabSize |
Labels
: MRUKAnchor.SceneLabels |
Anchors to include.
Each anchor labeled with one of these labels will have a prefab spawned for it.
Signature
MRUKAnchor.SceneLabels Labels |
MatchAspectRatio
: bool |
When enabled, the prefab will be rotated to try and match the aspect ratio of the volume as closely as possible.
This is most useful for long and thin volumes; keep this disabled for objects with an aspect ratio close to 1:1. Only applies to volumes.
Signature
bool MatchAspectRatio |
Prefabs
: List< GameObject > |
This list contains the prefabs that can be spawned for the specified labels.
The prefab will be chosen depending on the SelectionMode set for this group.
Signature
List<GameObject> Prefabs |
PrefabSelection
: SelectionMode |
The logic that determines what prefab to choose when spawning the relative labels' game objects.
Signature
SelectionMode PrefabSelection |
Scaling
: ScalingMode |
Set what scaling mode to apply to the prefab.
By default, the prefab will be stretched to fit the size of the plane/volume. But in some cases, this may not be desirable and can be customized here.
Signature
ScalingMode Scaling |
| Member | Description |
|---|---|
Stretch |
Stretch each axis to exactly match the size of the Plane/Volume.
This mode ensures that the prefab fills the entire anchor area.
|
UniformScaling |
Scale each axis by the same amount to maintain the correct aspect ratio.
This mode preserves the original aspect ratio of the prefab.
|
UniformXZScale |
Scale the X and Z axes uniformly but the Y scale can be different.
This mode allows for flexible scaling while maintaining some aspect ratio consistency.
|
NoScaling |
Don't perform any scaling.
This mode leaves the prefab at its original size, without any adjustments.
|
Custom |
Custom logic.
You MUST extend this class and override both CustomPrefabScaling(Vector2) and CustomPrefabScaling(Vector3) to use this mode.
|
| Member | Description |
|---|---|
Automatic |
For volumes align to the base, for planes align to the center.
This mode provides a default alignment that works well for most use cases.
|
Bottom |
Align the bottom of the prefab with the bottom of the volume or plane.
This mode is useful when you want the prefab to sit at the base of the anchor.
|
Center |
Align the center of the prefab with the center of the volume or plane.
This mode is useful when you want the prefab to be centered within the anchor.
|
NoAlignment |
Don't add any local offset to the prefab.
This mode leaves the prefab at its original position, without any adjustments.
|
Custom |
Custom logic.
You MUST extend this class and override both CustomPrefabAlignment(Bounds,Bounds?) and CustomPrefabAlignment(Rect,Bounds?) to use this mode.
|
| Member | Description |
|---|---|
Random |
Randomly choose a prefab from the list every time.
This mode adds randomness to the spawning process, making it more dynamic.
|
ClosestSize |
Choose the prefab that has the smallest difference between its size and the one of the anchor.
This mode selects the prefab that best fits the anchor's size, minimizing gaps or overlaps.
|
Custom |
Custom logic.
You MUST extend this class and override CustomPrefabSelection to use this mode.
|