API reference

AnchorPrefabSpawner Class

Extends MonoBehaviour, ICustomAnchorPrefabSpawner

Member Enumerations

Enumeration ScalingMode

Stretch
Stretch each axis to exactly match the size of the Plane/Volume.
UniformScaling
Scale each axis by the same amount to maintain the correct aspect ratio.
UniformXZScale
Scale the X and Z axes uniformly but the Y scale can be different.
NoScaling
Don't perform any scaling.
Custom
Custom logic, extend this class and override CustomPrefabScaling with your own implementation.

Enumeration AlignMode

Automatic
For volumes align to the base, for planes align to the center.
Bottom
Align the bottom of the prefab with the bottom of the volume or plane.
Center
Align the center of the prefab with the center of the volume or plane.
NoAlignment
Don't add any local offset to the prefab.
Custom
Custom logic, extend this class and override CustomPrefabAlignment with your own implementation.

Enumeration SelectionMode

Random
No description available
ClosestSize
No description available
Custom
Custom logic, extend this class and override CustomPrefabSelection with your own implementation.

Fields

MRUK.RoomFilter SpawnOnStart[Get]
int SeedValue[Get]
UnityEvent onPrefabSpawned[Get]
List< AnchorPrefabGroup > PrefabsToSpawn[Get]

Properties

Dictionary< MRUKAnchor, GameObject > AnchorPrefabSpawnerObjects[Get]
List< GameObject > SpawnedPrefabs[Get]

Protected Fields

Random _random[Get]

Protected Functions

virtual void ReceiveRemovedRoom
( MRUKRoom room )
virtual void UnRegisterAnchorUpdates
( MRUKRoom room )
virtual void RegisterAnchorUpdates
( MRUKRoom room )
virtual void ReceiveAnchorUpdatedCallback
( MRUKAnchor anchorInfo )
virtual void ReceiveAnchorRemovedCallback
( MRUKAnchor anchorInfo )
virtual void ReceiveAnchorCreatedEvent
( MRUKAnchor anchorInfo )
virtual void ReceiveCreatedRoom
( MRUKRoom room )
Clears all the spawned gameobjects from this AnchorPrefabSpawner in the given room.
Parameters
room
The room from where to remove all the spawned objects
virtual void ClearPrefab
( GameObject go )
Clears the gameobject associated with the anchor.
Useful when receiving an event that a specific anchor has been removed
Parameters
anchorInfo
The anchor reference
Clears all the gameobjects created with the PrefabSpawner.
Spawns prefabs according to the settings.
Parameters
clearPrefabs
Clear already existing prefabs before.
Creates gameobjects for the given room.
Parameters
room
The room reference
clearPrefabs
clear all before adding them again
virtual void SpawnPrefab
( MRUKAnchor anchorInfo )

Member Functions

Initializes a new instance of the Random class using the current seed.
Selects a prefab based on custom logic.
This method is intended to be overridden in a class that extends AnchorPrefabSpawner with custom logic for selecting a prefab. It will be called whenever the PrefabSelection of an AnchorPrefabGroup is set to Custom.
Parameters
anchor
The anchor info to use.
prefabs
The list of prefabs to select from. Can be null.
Returns
The selected prefab.
Scales a prefab based on custom logic.
This method is intended to be overridden in a class that extends AnchorPrefabSpawner with custom logic for scaling a prefab. If not overridden, it throws a NotImplementedException.
Parameters
localScale
The local scale of the prefab.
Returns
The scaled local scale of the prefab.
Scales a prefab based on custom logic.
This method is intended to be overridden a class that extends AnchorPrefabSpawner with custom logic for scaling a prefab. If not overridden, it throws a NotImplementedException.
Parameters
localScale
The local scale of the prefab.
Returns
The scaled local scale of the prefab.
Aligns a prefab to an anchor's volume, based on custom logic.
This method is intended to be overridden a class that extends AnchorPrefabSpawner with custom logic for aligning a prefab. If not overridden, it throws a NotImplementedException.
Parameters
anchorVolumeBounds
The volume bounds of the anchor.
prefabBounds
The bounds of the prefab.
Returns
The local position of the prefab defined as the difference between the anchor's pivot and the prefab's pivot.
Aligns a prefab to an anchor's plane rect, based on custom logic.
This method is intended to be overridden a class that extends AnchorPrefabSpawner with custom logic for aligning a prefab. If not overridden, it throws a NotImplementedException.
Parameters
anchorPlaneRect
The volume bounds of the anchor.
prefabBounds
The bounds of the prefab.
Returns
The local position of the prefab defined as the difference between the anchor's pivot and the prefab's pivot.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon