Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [SerializeField] bool drawGrid = false;
- [SerializeField] float gridSize = 1;
- [SerializeField] float cellSize = 1;
- void OnDrawGizmos()
- {
- if (drawGrid == false)
- return;
- Gizmos.color = Color.red;
- for (int x = 0; x < gridSize + 1; x++)
- {
- Vector3 startPosition = new Vector3(0, 0.1f, x*cellSize);
- Vector3 endPosition = new Vector3(gridSize * cellSize, 0.1f, x * cellSize);
- Gizmos.DrawLine(startPosition, endPosition);
- }
- for (int x = 0; x < gridSize + 1; x++)
- {
- Vector3 startPosition = new Vector3(x * cellSize, 0.1f, 0);
- Vector3 endPosition = new Vector3(x * cellSize, 0.1f, gridSize * cellSize);
- Gizmos.DrawLine(startPosition, endPosition);
- }
- }
Add Comment
Please, Sign In to add comment