1
This commit is contained in:
34
Src/UnityEditor/SceneGizmoReference.cs
Normal file
34
Src/UnityEditor/SceneGizmoReference.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
// ReSharper disable FieldCanBeMadeReadOnly.Global
|
||||
|
||||
namespace BITKit.Scene
|
||||
{
|
||||
public class SceneGizmoReference : MonoBehaviour
|
||||
{
|
||||
[Export]
|
||||
public static bool AllowGizmos=true;
|
||||
|
||||
[SerializeField] private bool draw;
|
||||
[SerializeField] private Color color;
|
||||
[SerializeField] private float size;
|
||||
|
||||
[SerializeField] private Optional<Vector3> bounds;
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
if (draw is false || AllowGizmos is false) return;
|
||||
var position = transform.position;
|
||||
Gizmos.color = color;
|
||||
Gizmos.DrawWireSphere(position, size);
|
||||
|
||||
if (bounds.Allow)
|
||||
{
|
||||
var rotation = transform.rotation;
|
||||
Gizmos.DrawWireCube(position+rotation*bounds.Value/2, rotation*bounds.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user