Table of Contents

Class ComputeContextQueries

Namespace
nadena.dev.ndmf.preview
public static class ComputeContextQueries
Inheritance
ComputeContextQueries
Inherited Members

Methods

ActiveAndEnabled(ComputeContext, Behaviour, string, int)

Observes whether a component is enabled, and its heirarchy path is active.

public static bool ActiveAndEnabled(this ComputeContext ctx, Behaviour c, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
c Behaviour
callerPath string
callerLine int

Returns

bool

ActiveInHierarchy(ComputeContext, GameObject, string, int)

Observes whether a given game object and all its parents are active.

public static bool ActiveInHierarchy(this ComputeContext ctx, GameObject obj, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
obj GameObject
callerPath string
callerLine int

Returns

bool

GetAvatarRoot(ComputeContext, GameObject, string, int)

Gets the avatar root for a game object.

public static GameObject GetAvatarRoot(this ComputeContext context, GameObject obj, string callerPath = "", int callerLine = 0)

Parameters

context ComputeContext
obj GameObject
callerPath string
callerLine int

Returns

GameObject

Exceptions

NotImplementedException

GetAvatarRoots(ComputeContext)

public static ImmutableList<GameObject> GetAvatarRoots(this ComputeContext ctx)

Parameters

ctx ComputeContext

Returns

ImmutableList<GameObject>

GetComponent(ComputeContext, GameObject, Type, string, int)

public static Component GetComponent(this ComputeContext ctx, GameObject obj, Type type, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
obj GameObject
type Type
callerPath string
callerLine int

Returns

Component

GetComponent<C>(ComputeContext, GameObject, string, int)

public static C GetComponent<C>(this ComputeContext ctx, GameObject obj, string callerPath = "", int callerLine = 0) where C : class

Parameters

ctx ComputeContext
obj GameObject
callerPath string
callerLine int

Returns

C

Type Parameters

C

GetComponents(ComputeContext, GameObject, Type, string, int)

public static Component[] GetComponents(this ComputeContext ctx, GameObject obj, Type type, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
obj GameObject
type Type
callerPath string
callerLine int

Returns

Component[]

GetComponentsByType(ComputeContext, Type)

public static ImmutableList<Component> GetComponentsByType(this ComputeContext ctx, Type type)

Parameters

ctx ComputeContext
type Type

Returns

ImmutableList<Component>

GetComponentsByType<T>(ComputeContext)

Returns a reactive value that evaluates to a list of all components of the given type in the scene. Excludes components found on a hidden game object, or under a hidden scene root (where hidden means hideFlags are nonzero)

public static ImmutableList<T> GetComponentsByType<T>(this ComputeContext ctx) where T : class

Parameters

ctx ComputeContext

Returns

ImmutableList<T>

Type Parameters

T

The type to search for

GetComponentsInChildren(ComputeContext, GameObject, Type, bool, string, int)

public static Component[] GetComponentsInChildren(this ComputeContext ctx, GameObject obj, Type type, bool includeInactive, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
obj GameObject
type Type
includeInactive bool
callerPath string
callerLine int

Returns

Component[]

GetComponentsInChildren<C>(ComputeContext, GameObject, bool, string, int)

public static C[] GetComponentsInChildren<C>(this ComputeContext ctx, GameObject obj, bool includeInactive, string callerPath = "", int callerLine = 0) where C : class

Parameters

ctx ComputeContext
obj GameObject
includeInactive bool
callerPath string
callerLine int

Returns

C[]

Type Parameters

C

GetComponents<C>(ComputeContext, GameObject, string, int)

public static C[] GetComponents<C>(this ComputeContext ctx, GameObject obj, string callerPath = "", int callerLine = 0) where C : class

Parameters

ctx ComputeContext
obj GameObject
callerPath string
callerLine int

Returns

C[]

Type Parameters

C

GetSceneRoots(ComputeContext)

Returns a list of all root game objects in all loaded scenes. Excludes objects with nonzero hide flags.

public static ImmutableList<GameObject> GetSceneRoots(this ComputeContext ctx)

Parameters

ctx ComputeContext

Returns

ImmutableList<GameObject>

ObservePath(ComputeContext, Transform)

Observes the full path from the scene root to the given transform. The calling computation will be re-executed if any of the objects in this path are reparented.

public static IEnumerable<Transform> ObservePath(this ComputeContext ctx, Transform obj)

Parameters

ctx ComputeContext
obj Transform

Returns

IEnumerable<Transform>

An enumerable of transforms in the path, starting from the leaf.

ObserveTransformPosition(ComputeContext, Transform)

Observes the world space position of a given transform.

public static Transform ObserveTransformPosition(this ComputeContext ctx, Transform t)

Parameters

ctx ComputeContext
t Transform

Returns

Transform

Observe<T>(ComputeContext, T, string, int)

Monitors a given Unity object for changes, and recomputes when changes are detected.

This will recompute when properties of the object change, when the object is destroyed, or (in the case of a GameObject), when the children of the GameObject changed. However, it will only respond to changes which are recorded in the Undo system; in particular, it will not respond to animation previews. This is provided to deal with cases where asset changes can't be reported in any other way.

public static T Observe<T>(this ComputeContext ctx, T obj, string callerPath = "", int callerLine = 0) where T : UnityEngine.Object

Parameters

ctx ComputeContext
obj T
callerPath string
callerLine int

Returns

T

Type Parameters

T

Observe<T>(ComputeContext, PublishedValue<T>, string, int)

Observes a value published via the given PublishedValue token. The calling computation will be re-executed whenever the value changes (as determined by IEquatable)

public static T Observe<T>(this ComputeContext ctx, PublishedValue<T> val, string callerPath = "", int callerLine = 0) where T : IEquatable<T>

Parameters

ctx ComputeContext
val PublishedValue<T>
callerPath string
callerLine int

Returns

T

Type Parameters

T

Observe<T, R>(ComputeContext, T, Func<T, R>, Func<R, R, bool>, string, int)

Monitors a given Unity object for changes, and recomputes when changes are detected. The extract function is used to extract the specific information of interest from the object, and the compare function (or, if not provided, the default equality comparer) is used to determine if the extracted information has changed.

public static R Observe<T, R>(this ComputeContext ctx, T obj, Func<T, R> extract, Func<R, R, bool> compare = null, string callerPath = "", int callerLine = 0) where T : UnityEngine.Object

Parameters

ctx ComputeContext
obj T
extract Func<T, R>
compare Func<R, R, bool>
callerPath string
callerLine int

Returns

R

Type Parameters

T
R

Observe<T, R>(ComputeContext, PublishedValue<T>, Func<T, R>, Func<R, R, bool>, string, int)

Observes a value published via the given PublishedValue token, and extracts a value from it using the given transformation. The calling computation will be re-executed whenever the extracted value changes (as determined by the given equality function)

public static R Observe<T, R>(this ComputeContext ctx, PublishedValue<T> val, Func<T, R> extract, Func<R, R, bool> eq, string callerPath = "", int callerLine = 0)

Parameters

ctx ComputeContext
val PublishedValue<T>
extract Func<T, R>
eq Func<R, R, bool>
callerPath string
callerLine int

Returns

R

The extracted value

Type Parameters

T

Type of the value in the PublishedValue

R

Type of the extracted value

Observe<T, R>(ComputeContext, PublishedValue<T>, Func<T, R>, string, int)

Observes a value published via the given PublishedValue token, and extracts a value from it using the given transformation. The calling computation will be re-executed whenever the extracted value changes (as determined by IEquatable)

public static R Observe<T, R>(this ComputeContext ctx, PublishedValue<T> val, Func<T, R> extract, string callerPath = "", int callerLine = 0) where R : IEquatable<R>

Parameters

ctx ComputeContext
val PublishedValue<T>
extract Func<T, R>
callerPath string
callerLine int

Returns

R

The extracted value

Type Parameters

T

Type of the value in the PublishedValue

R

Type of the extracted value