Skip to content

Commit

Permalink
Update pb_ObjectUtility.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
FALsGames authored Jun 12, 2020
1 parent 8c81366 commit 6e1e678
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Assets/GILES/Code/Classes/Extension/pb_ObjectUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@ namespace GILES
{
public static class pb_ObjectUtility
{
/**
* Add an empty gameObject as a child to `go`.
*/
///<summary>
/// Add an empty gameObject as a child to `go`.
///</summary>
public static GameObject AddChild(this GameObject go)
{
GameObject child = new GameObject();
child.transform.SetParent(go.transform);
return child;
}

/**
* Add an empty gameObject as a child to `trs`.
*/
///<summary>
/// Add an empty gameObject as a child to `trs`.
///</summary>
public static Transform AddChild(this Transform trs)
{
Transform go = new GameObject().GetComponent<Transform>();
go.SetParent(trs);
return go;
}

///<summary>
///Calculates the min dist. to the bounds.
///</summary>
public static float CalcMinDistanceToBounds(Camera cam, Bounds bounds)
{
float frustumHeight = Mathf.Max(Mathf.Max(bounds.size.x, bounds.size.y), bounds.size.z);
Expand All @@ -38,4 +40,4 @@ public static void Destroy<T>(T obj) where T : UnityEngine.Object
GameObject.Destroy(obj);
}
}
}
}

0 comments on commit 6e1e678

Please sign in to comment.