ActionExt.ToLoop Method

Creates a UxrLoopController which wraps a cancellable loop executing this Action in the main thread.

Namespace: UltimateXR.Extensions.System.Threading
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static UxrLoopController ToLoop(
	this Action self,
	float rate = 10f,
	int autoStartDelay = -1
)

Parameters

 

self
Type: System.Action
Action to loop at rate Hz
rate (Optional)
Type: System.Single
Loop frequency in Hz
autoStartDelay (Optional)
Type: System.Int32
Delay in milliseconds before loop executes its first iteration.  
  • Equal or greater than zero: tells UxrLoopController to automatically start looping autoStartDelay milliseconds after creation.
  • Negative (default) [!:UxrLoopController.Start()] needs to be called on returned UxrLoopController to start looping.

Return Value

Type: UxrLoopController
A UxrLoopController to handle ([!:UxrLoopController.Start()], [!:UxrLoopController.Stop]) the loop execution.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Action. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

ActionExt Class
UltimateXR.Extensions.System.Threading Namespace
UltimateXR.Core.Threading.TaskControllers.UxrLoopController
ActionExt.Loop(Action, Single, CancellationToken)
ActionExt.ToThreadedLoop(Action, Single, Int32)