Skip to content

Instantly share code, notes, and snippets.

@rakkarage
Created April 19, 2018 15:43
Show Gist options
  • Save rakkarage/09adeef926b6c6f4e42d97b0f9aa6ce3 to your computer and use it in GitHub Desktop.
Save rakkarage/09adeef926b6c6f4e42d97b0f9aa6ce3 to your computer and use it in GitHub Desktop.
Unity BoundsInt Visualization Test
using UnityEngine;
public class TestBoundsInt : MonoBehaviour
{
public BoundsInt Bounds;
public Vector3Int Vector;
void OnDrawGizmosSelected()
{
var offset = new Vector3(.5f, .5f, 0f);
Gizmos.color = Color.blue;
Gizmos.DrawWireCube(Bounds.center, Bounds.size);
Gizmos.color = Color.white;
Gizmos.DrawWireCube(Bounds.min + offset, Vector3Int.one);
Gizmos.color = Color.white;
Gizmos.DrawWireCube(Bounds.max + offset, Vector3Int.one);
Gizmos.color = Bounds.Contains(Bounds.position + Vector) ? Color.green : Color.red;
Gizmos.DrawWireCube(Bounds.position + Vector + offset, Vector3Int.one);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment