Class ComputeContext
Tracks dependencies around a single computation. Generally, this object should be retained as long as we need to receive invalidation events (GCing this object may deregister invalidation events).
public sealed class ComputeContext
- Inheritance
-
ComputeContext
- Inherited Members
- Extension Methods
Constructors
ComputeContext(string)
public ComputeContext(string description)
Parameters
description
string
Properties
Invalidate
An Action which can be used to invalidate this compute context (possibly triggering a recompute).
public Action Invalidate { get; }
Property Value
IsInvalidated
public bool IsInvalidated { get; }
Property Value
NullContext
public static ComputeContext NullContext { get; }
Property Value
Methods
~ComputeContext()
protected ~ComputeContext()
FlushInvalidates()
ComputeContext deferres some processing until EditorApplication.delayCall on invalidate. Invoke this function to flush and execute all pending invalidates immediately.
public static void FlushInvalidates()
Invalidates(ComputeContext)
Invalidate the other
compute context when this compute context is invalidated.
public void Invalidates(ComputeContext other)
Parameters
other
ComputeContext
InvokeOnInvalidate<T>(T, Action<T>)
Invokes the given receiver function when this context is invalidated. The target object is passed to the receiver.
This function does not maintain a strong reference to the target object; if the target object is GCed, the receiver will not be invoked. You may also cancel this subscription by disposing the returned IDisposable.
Must be invoked on the unity main thread.
public IDisposable InvokeOnInvalidate<T>(T target, Action<T> receiver)
Parameters
target
Treceiver
Action<T>
Returns
Type Parameters
T
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.