X Tutup
Skip to content

Commit 49bf5d2

Browse files
authored
Create RendererBoundsGizmo.cs
1 parent ddb602f commit 49bf5d2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// attach this to mesh, draws renderer bounds when gameobject is selected
2+
// original source: http://answers.unity.com/answers/137475/view.html
3+
4+
using UnityEngine;
5+
6+
namespace UnityLibrary
7+
{
8+
public class RendererBoundsGizmo : MonoBehaviour
9+
{
10+
void OnDrawGizmos()
11+
{
12+
OnDrawGizmosSelected();
13+
}
14+
15+
void OnDrawGizmosSelected()
16+
{
17+
Gizmos.color = Color.yellow;
18+
//center sphere
19+
//Gizmos.DrawSphere(transform.position, 0.1f);
20+
var r = transform.GetComponent<Renderer>();
21+
if (r != null) Gizmos.DrawWireCube(transform.position, r.bounds.size);
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)
X Tutup