Created
April 19, 2018 15:43
-
-
Save rakkarage/09adeef926b6c6f4e42d97b0f9aa6ce3 to your computer and use it in GitHub Desktop.
Unity BoundsInt Visualization Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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