Class SceneExtensions
Inheritance
System.Object
SceneExtensions
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()
Assembly: cs.temp.dll.dll
Syntax
public static class SceneExtensions
Methods
Destroys GameObject, but ensure that it is properly unpacked if gameobject is part of a prefab (if editor)
Declaration
public static void DestroyImmediateSafe(this GameObject gameObject)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
ExplodeSubmeshes(GameObject, Boolean)
Explodes submeshes from a given GameObject into multiple child GameObjects.
Declaration
public static List<GameObject> ExplodeSubmeshes(this GameObject gameObject, bool firstSubmeshAsParent)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
| System.Boolean |
firstSubmeshAsParent |
If true, the first submesh will stay in the gameObject's mesh. Otherwise, one child GameObject is created per submesh and the original meshfilter and renderers gets destroyed.
|
Returns
| Type |
Description |
| System.Collections.Generic.List<GameObject> |
|
GetBoundsWorldSpace(GameObject, Boolean)
Returns bounds in world space
Declaration
public static Bounds GetBoundsWorldSpace(this GameObject gameObject, bool includeChildren)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
Object to take bounds from
|
| System.Boolean |
includeChildren |
|
Returns
GetBoundsWorldSpace(IList<GameObject>)
Returns bounds in world space
Declaration
public static Bounds GetBoundsWorldSpace(this IList<GameObject> gameObjects)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
gameObjects |
|
Returns
GetChildren(GameObject, Boolean, Boolean)
Returns all children (recursive) of given GameObjects
Declaration
public static List<GameObject> GetChildren(this GameObject gameObject, bool recursive, bool includeParent)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
| System.Boolean |
recursive |
If true, it will gather children recursively
|
| System.Boolean |
includeParent |
If true, input GameObject will be present in the output
|
Returns
| Type |
Description |
| System.Collections.Generic.List<GameObject> |
|
GetChildren(IList<GameObject>, Boolean, Boolean)
Returns all children (recursive) of given GameObjects
Declaration
public static IList<GameObject> GetChildren(this IList<GameObject> gameObjects, bool recursive, bool includeParent)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
gameObjects |
Input GameObjects
|
| System.Boolean |
recursive |
If true, it will gather children recursively
|
| System.Boolean |
includeParent |
If true, input GameObjects will be present in the output
|
Returns
| Type |
Description |
| System.Collections.Generic.IList<GameObject> |
|
GetDefaultShader()
Declaration
public static Shader GetDefaultShader()
Returns
GetGameObjectsInLayer(Int32)
Returns all GameObjects in given layer
Declaration
public static List<GameObject> GetGameObjectsInLayer(int layer)
Parameters
| Type |
Name |
Description |
| System.Int32 |
layer |
|
Returns
| Type |
Description |
| System.Collections.Generic.List<GameObject> |
|
GetHighestAncestor(IList<GameObject>)
Returns the highest ancestor (hierarchically) of a list of GameObjects
Declaration
public static GameObject GetHighestAncestor(IList<GameObject> gameObjects)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
gameObjects |
|
Returns
| Type |
Description |
| GameObject |
|
GetMaterials(IList<GameObject>)
Returns an array of unique materials from given GameObjects
Declaration
public static Material[] GetMaterials(this IList<GameObject> input)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
input |
|
Returns
| Type |
Description |
| Material[] |
|
GetMesh(GameObject)
Declaration
public static Mesh GetMesh(this GameObject gameObject)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
Returns
GetMeshes(IList<GameObject>)
Declaration
public static Mesh[] GetMeshes(this IList<GameObject> input)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
input |
|
Returns
GetMeshesUnique(IList<GameObject>)
Returns an array of unique meshes from given GameObjects.
Declaration
public static Mesh[] GetMeshesUnique(this IList<GameObject> input)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
input |
|
Returns
GetOrAddComponent<T>(GameObject)
Returns the Component of the given type. It will add a new one if it doesn't exists.
Declaration
public static T GetOrAddComponent<T>(this GameObject gameObject)
where T : Component
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
GameObject
|
Returns
Type Parameters
| Name |
Description |
| T |
Component Type
|
GetRenderers(IList<GameObject>)
Returns an array of renderers from given GameObjects.
Declaration
public static Renderer[] GetRenderers(this IList<GameObject> input)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IList<GameObject> |
input |
|
Returns
| Type |
Description |
| Renderer[] |
|
Instantiate(GameObject)
Context adapted delegate for instantiating Unity Objects.
In runtime, it will create a clone.
In editor, it will instantiate the prefab.
Declaration
public static GameObject Instantiate(GameObject gameObject)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
Returns
| Type |
Description |
| GameObject |
|
Check if the localPosition is Vector3(0,0,0), localRotation is Identity and localScale is Vector(1,1,1)
Declaration
public static bool LocalIsIdentity(this Transform transform)
Parameters
| Type |
Name |
Description |
| Transform |
transform |
|
Returns
| Type |
Description |
| System.Boolean |
|
MergeChildren(GameObject)
Merge children (recursively) of given GameObject.
If given GameObject has no mesh or renderer, this method will create it with the merged content inside.
Declaration
public static void MergeChildren(this GameObject gameObject)
Parameters
| Type |
Name |
Description |
| GameObject |
gameObject |
|
Change Tranform's parent, but ensures it is properly unpack if transform is part of a prefab (if editor)
Declaration
public static void SetParentSafe(this Transform transform, Transform parent, bool worldPositionStays = true)
Parameters
| Type |
Name |
Description |
| Transform |
transform |
|
| Transform |
parent |
|
| System.Boolean |
worldPositionStays |
|