Class RuntimeUtility
An ad-hoc collection of helpers, used by Cinemachine or its editor tools in various places
Inherited Members
Namespace: Cinemachine
Assembly: Cinemachine.dll
Syntax
[DocumentationSorting(DocumentationSortingAttribute.Level.Undoc)]
public static class RuntimeUtility
Methods
DestroyObject(Object)
Convenience to destroy an object, using the appropriate method depending on whether the game is playing
Declaration
public static void DestroyObject(Object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to destroy |
IsPrefab(GameObject)
Check whether a GameObject is a prefab.
For editor only - some things are disallowed if prefab. In runtime, will always return false.
Declaration
public static bool IsPrefab(GameObject gameObject)
Parameters
Type | Name | Description |
---|---|---|
Game |
gameObject | the object to check |
Returns
Type | Description |
---|---|
bool | If editor, checks if object is a prefab or prefab instance. |
NormalizeCurve(AnimationCurve, bool, bool)
Normalize a curve so that its X and Y axes range from 0 to 1
Declaration
public static AnimationCurve NormalizeCurve(AnimationCurve curve, bool normalizeX, bool normalizeY)
Parameters
Type | Name | Description |
---|---|---|
Animation |
curve | Curve to normalize |
bool | normalizeX | If true, normalize the X axis |
bool | normalizeY | If true, normalize the Y axis |
Returns
Type | Description |
---|---|
Animation |
The normalized curve |
RaycastIgnoreTag(Ray, out RaycastHit, float, int, in string)
Perform a raycast, but pass through any objects that have a given tag
Declaration
public static bool RaycastIgnoreTag(Ray ray, out RaycastHit hitInfo, float rayLength, int layerMask, in string ignoreTag)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The ray to cast |
Raycast |
hitInfo | The returned results |
float | rayLength | Length of the raycast |
int | layerMask | Layers to include |
string | ignoreTag | Tag to ignore |
Returns
Type | Description |
---|---|
bool | True if something was hit. Results in hitInfo |
SphereCastIgnoreTag(Vector3, float, Vector3, out RaycastHit, float, int, in string)
Perform a sphere cast, but pass through objects with a given tag
Declaration
public static bool SphereCastIgnoreTag(Vector3 rayStart, float radius, Vector3 dir, out RaycastHit hitInfo, float rayLength, int layerMask, in string ignoreTag)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | rayStart | Start of the ray |
float | radius | Radius of the sphere cast |
Vector3 | dir | Normalized direction of the ray |
Raycast |
hitInfo | Results go here |
float | rayLength | Length of the ray |
int | layerMask | Layers to include |
string | ignoreTag | Tag to ignore |
Returns
Type | Description |
---|---|
bool | True if something is hit. Results in hitInfo. |