Show / Hide Table of Contents

Class UnityExtensions

Extensions for Unity objects, and particularly for interacting with Scenes.

Inheritance
System.Object
UnityExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ItemChanger.Extensions
Assembly: ItemChanger.dll
Syntax
public static class UnityExtensions

Methods

| Improve this Doc View Source

FindChild(GameObject, IEnumerable<String>)

Declaration
public static GameObject FindChild(this GameObject g, IEnumerable<string> steps)
Parameters
Type Name Description
GameObject g
IEnumerable<System.String> steps
Returns
Type Description
GameObject
| Improve this Doc View Source

FindChild(GameObject, String)

Declaration
public static GameObject? FindChild(this GameObject g, string name)
Parameters
Type Name Description
GameObject g
System.String name
Returns
Type Description
System.Nullable<GameObject>
| Improve this Doc View Source

FindChildInHierarchy(GameObject, String)

Breadth first search. Returns GameObject with given name, or null if not found. Parent object not included in search.

Declaration
public static GameObject? FindChildInHierarchy(this GameObject g, string name)
Parameters
Type Name Description
GameObject g
System.String name
Returns
Type Description
System.Nullable<GameObject>
| Improve this Doc View Source

FindGameObject(Scene, String)

Finds a GameObject in the given scene by its full path.

Declaration
public static GameObject? FindGameObject(this Scene s, string path)
Parameters
Type Name Description
Scene s
System.String path

The full path to the GameObject, with forward slash ('/') separators.

Returns
Type Description
System.Nullable<GameObject>
| Improve this Doc View Source

FindGameObjectByName(Scene, String)

Breadth first search through the entire hierarchy. Returns the first GameObject with the given name, or null.

Declaration
public static GameObject? FindGameObjectByName(this Scene s, string name)
Parameters
Type Name Description
Scene s
System.String name
Returns
Type Description
System.Nullable<GameObject>
| Improve this Doc View Source

GetPathInHierarchy(Transform)

Declaration
public static string GetPathInHierarchy(this Transform t)
Parameters
Type Name Description
Transform t
Returns
Type Description
System.String
| Improve this Doc View Source

Traverse(Scene)

Returns a list of objects in the scene hierarchy, ordered by depth-first-search.
The list consists of pairs where the first entry is the object path and the second entry is the object.

Declaration
public static List<(string path, GameObject go)> Traverse(this Scene s)
Parameters
Type Name Description
Scene s
Returns
Type Description
List<System.ValueTuple<System.String, GameObject>>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX