public class CustomPrefabSpawner : AnchorPrefabSpawner {
public override GameObject CustomPrefabSelection(MRUKAnchor anchor, List<GameObject> prefabs)
{
prefabs[0].GetComponentInChildren<Collider>().enabled = true;
return prefabs[0];
}
}CustomPrefabAlignment
(
anchorVolumeBounds
, prefabBounds
)
|
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.
Signature
Vector3 CustomPrefabAlignment(Bounds anchorVolumeBounds, Bounds? prefabBounds) Parameters anchorVolumeBounds: BoundsÂ
The volume bounds of the anchor.
prefabBounds: Bounds?Â
The bounds of the prefab.
Returns Vector3Â
The local position of the prefab defined as the difference between the anchor's pivot and the prefab's pivot.
|
CustomPrefabAlignment
(
anchorPlaneRect
, prefabBounds
)
|
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.
Signature
Vector3 CustomPrefabAlignment(Rect anchorPlaneRect, Bounds? prefabBounds) Parameters anchorPlaneRect: RectÂ
The volume bounds of the anchor.
prefabBounds: Bounds?Â
The bounds of the prefab.
Returns Vector3Â
The local position of the prefab defined as the difference between the anchor's pivot and the prefab's pivot.
|
CustomPrefabScaling
(
localScale
)
|
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.
Signature
Vector3 CustomPrefabScaling(Vector3 localScale) Parameters localScale: Vector3Â
The local scale of the prefab.
Returns Vector3Â
The scaled local scale of the prefab.
|
CustomPrefabScaling
(
localScale
)
|
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.
Signature
Vector2 CustomPrefabScaling(Vector2 localScale) Parameters localScale: Vector2Â
The local scale of the prefab.
Returns Vector2Â
The scaled local scale of the prefab.
|
CustomPrefabSelection
(
anchor
, prefabs
)
|
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.
Signature
GameObject CustomPrefabSelection(MRUKAnchor anchor, List< GameObject > prefabs) Parameters prefabs: List< GameObject >Â
The list of prefabs to select from. Can be null.
Returns GameObjectÂ
The selected prefab.
|