Class ScrollingObjectCollection
Implements
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
public class ScrollingObjectCollection : MonoBehaviour, IMixedRealityPointerHandler, IMixedRealitySourceStateHandler, IMixedRealityTouchHandler
Remarks
Executing also in edit mode to properly catch and mask any new content added to scroll container.
Fields
OnClick
Event that is fired on the target object when the ScrollingObjectCollection deems event as a Click.
Declaration
public ScrollingObjectCollection.ScrollEvent OnClick
Field Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.ScrollEvent |
OnMomentumEnded
Event that is fired on the target object when the ScrollingObjectCollection is no longer in motion from velocity
Declaration
public UnityEvent OnMomentumEnded
Field Value
| Type | Description |
|---|---|
| UnityEvent |
OnMomentumStarted
Event that is fired on the target object when the ScrollingObjectCollection is starting motion with velocity.
Declaration
public UnityEvent OnMomentumStarted
Field Value
| Type | Description |
|---|---|
| UnityEvent |
OnTouchEnded
Event that is fired on the target object when the ScrollingObjectCollection is no longer touched.
Declaration
public ScrollingObjectCollection.ScrollEvent OnTouchEnded
Field Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.ScrollEvent |
OnTouchStarted
Event that is fired on the target object when the ScrollingObjectCollection is touched.
Declaration
public ScrollingObjectCollection.ScrollEvent OnTouchStarted
Field Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.ScrollEvent |
Properties
AnimationLength
The amount of time (in seconds) the PaginationCurve will take to evaluate.
Declaration
public float AnimationLength { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
BounceMultiplier
Multiplier to add more bounce to the overscroll of a list when using FalloffPerFrame or FalloffPerItem.
Declaration
public float BounceMultiplier { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
CanScroll
Enables/disables scrolling with near/far interaction.
Declaration
public bool CanScroll { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Remarks
Helpful for controls where you may want pagination or list movement without freeform scrolling.
CellDepth
Depth of cell used for masking out content renderers that are out of bounds.
Declaration
public float CellDepth { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
CellHeight
Height of the pagination cell.Hhide
Declaration
public float CellHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
CellsPerTier
Number of cells in a row on up-down scroll or number of cells in a column on left-right scroll.
Declaration
public int CellsPerTier { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
CellWidth
Width of the pagination cell.
Declaration
public float CellWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
ClipBox
The ScrollingObjectCollection's ClippingBox that is used for clipping items in and out of the list.
Declaration
public ClippingBox ClipBox { get; }
Property Value
| Type | Description |
|---|---|
| ClippingBox |
ClippingObject
The empty GameObject containing the ScrollingObjectCollection's ClippingBox.
Declaration
public GameObject ClippingObject { get; }
Property Value
| Type | Description |
|---|---|
| GameObject |
ColliderEditMode
Edit modes for defining the scroll interaction collider boundaries. Choose 'Auto' to automatically use pagination values. Choose 'Manual' for enabling direct manipulation of the collider.
Declaration
public ScrollingObjectCollection.EditMode ColliderEditMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.EditMode |
DisableClippedGameObjects
Disables GameObjects with Renderer components which are clipped by the clipping box. Improves performance significantly by reducing the number of GameObjects that need to be managed in engine.
Declaration
public bool DisableClippedGameObjects { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
DisableClippedRenderers
Disables the Renderer components of Gameobjects which are clipped by the clipping box. Improves performance by reducing the number of renderers that need to be tracked, while still allowing the GameObjects associated with those renders to continue updating. Less performant compared to using DisableClippedGameObjects
Declaration
public bool DisableClippedRenderers { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
FirstHiddenCellIndex
Index of the first hidden cell.
Declaration
public int FirstHiddenCellIndex { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
FirstVisibleCellIndex
Index of the first visible cell.
Declaration
public int FirstVisibleCellIndex { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
FrontTouchDistance
Distance, in meters, to position a local xy plane used to verify if a touch interaction started in the front of the scroll view.
Declaration
public float FrontTouchDistance { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
HandDeltaScrollThreshold
The distance, in meters, the current pointer can travel along the scroll direction before triggering a scroll drag.
Declaration
public float HandDeltaScrollThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
HasMomentum
Tracks whether the scroll has any kind of momentum. True if scroll is being dragged by a controller, the velocity is falling off after a drag release or during pagination movement.
Declaration
public bool HasMomentum { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsDragging
Tracks whether the scroll is being dragged due to a controller movement.
Declaration
public bool IsDragging { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsEngaged
Tracks whether content or scroll background is being interacted with.
Declaration
public bool IsEngaged { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
IsTouched
Tracks whether the scroll content or background is touched by a near pointer. Remains true while the same near pointer does not cross the scrolling release boundaries.
Declaration
public bool IsTouched { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
MaskEditMode
Edit modes for defining the clipping box masking boundaries. Choose 'Auto' to automatically use pagination values. Choose 'Manual' for enabling direct manipulation of the clipping box object.
Declaration
public ScrollingObjectCollection.EditMode MaskEditMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.EditMode |
MaskEnabled
Visibility mode of scroll content. Default value will mask all objects outside of the scroll viewable area.
Declaration
public bool MaskEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
PaginationCurve
Animation curve used to interpolate the pagination and movement methods.
Declaration
public AnimationCurve PaginationCurve { get; set; }
Property Value
| Type | Description |
|---|---|
| AnimationCurve |
ReleaseThresholdBack
Withdraw amount, in meters, from the back of the scroll boundary needed to transition from touch engaged to released.
Declaration
public float ReleaseThresholdBack { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
ReleaseThresholdFront
Withdraw amount, in meters, from the front of the scroll boundary needed to transition from touch engaged to released.
Declaration
public float ReleaseThresholdFront { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
ReleaseThresholdLeftRight
Withdraw amount, in meters, from the right or left of the scroll boundary needed to transition from touch engaged to released.
Declaration
public float ReleaseThresholdLeftRight { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
ReleaseThresholdTopBottom
Withdraw amount, in meters, from the top or bottom of the scroll boundary needed to transition from touch engaged to released.
Declaration
public float ReleaseThresholdTopBottom { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
ScrollContainerPosition
The local position of the moving scroll container. Can be used to represent the container drag displacement.
Declaration
public Vector3 ScrollContainerPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
ScrollDirection
The direction in which content should scroll.
Declaration
public ScrollingObjectCollection.ScrollDirectionType ScrollDirection { get; set; }
Property Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.ScrollDirectionType |
ScrollingCollider
Scrolling interaction collider used to catch pointer and touch events on empty spaces.
Declaration
public BoxCollider ScrollingCollider { get; }
Property Value
| Type | Description |
|---|---|
| BoxCollider |
ScrollingTouchable
Scrolling interaction touchable used to catch touch events on empty spaces.
Declaration
public NearInteractionTouchable ScrollingTouchable { get; }
Property Value
| Type | Description |
|---|---|
| NearInteractionTouchable |
TiersPerPage
Number of visible tiers in the scrolling area.
Declaration
public int TiersPerPage { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
TypeOfVelocity
The desired type of velocity for the scroller.
Declaration
public ScrollingObjectCollection.VelocityType TypeOfVelocity { get; set; }
Property Value
| Type | Description |
|---|---|
| ScrollingObjectCollection.VelocityType |
UseOnPreRender
Toggles whether Camera OnPreRender callback will be used to manage content visibility. The fallback is MonoBehaviour.LateUpdate().
Declaration
public bool UseOnPreRender { get; set; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Remarks
This is especially helpful if you're trying to scroll dynamically created objects that may be added to the list after LateUpdate,
VelocityDampen
Amount of drag applied to velocity.
Declaration
public float VelocityDampen { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
Remarks
This can't be 0.0f since that won't allow ANY velocity - set TypeOfVelocity to None. It can't be 1.0f since that won't allow ANY drag.
VelocityMultiplier
Amount of (extra) velocity to be applied to scroller.
Declaration
public float VelocityMultiplier { get; set; }
Property Value
| Type | Description |
|---|---|
| Single |
Remarks
Helpful if you want a small movement to fling the list.
Methods
AddContent(GameObject)
Safely adds a child game object to scroll collection.
Declaration
public void AddContent(GameObject content)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | content |
IsCellVisible(Int32)
Checks whether the given cell is visible relative to viewable area or page.
Declaration
public bool IsCellVisible(int cellIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | cellIndex | the index of the pagination cell |
Returns
| Type | Description |
|---|---|
| Boolean | true when cell is visible |
MoveByPages(Int32, Boolean, Action)
Moves scroller container by a multiplier of the number of tiers in the viewable area.
Declaration
public void MoveByPages(int numberOfPages, bool animate = true, Action callback = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | numberOfPages | Amount of pages to move by |
| Boolean | animate | If true, scroller will animate to new position |
| Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
MoveByTiers(Int32, Boolean, Action)
Moves scroller container a relative number of tiers of cells.
Declaration
public void MoveByTiers(int numberOfTiers, bool animate = true, Action callback = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | numberOfTiers | Amount of tiers to move by |
| Boolean | animate | if true, scroller will animate to new position |
| Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
MoveToIndex(Int32, Boolean, Action)
Moves scroller container to a position where the selected cell is in the first tier of the viewable area.
Declaration
public void MoveToIndex(int cellIndex, bool animateToPosition = true, Action callback = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | cellIndex | Index of the cell to move to |
| Boolean | animateToPosition | |
| Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
RemoveItem(GameObject)
Safely removes a child game object from scroll content and clipping box.
Declaration
public void RemoveItem(GameObject item)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | item |
Reset()
Resets the ScrollingObjectCollection
Declaration
public void Reset()
UpdateContent()
Sets up the scroll clipping object and the interactable components according to the scroll content and chosen settings.
Declaration
public void UpdateContent()