I am using Gizmos as a way to debug locations and hotspots in the editor, but I have noticed that my gizmos seem to scale with the object’s scale, which isn’t useful as it can mean that the visual hotspot isn’t actually the size the script is using.
So, I need to be able to scale the object for other reasons, but I need the latter gizmo (wire sphere) to NOT scale with the object.
My current code is:
private void DrawGizmo(bool selected)
{
var col = new Color(0.729f, 0.658f, 0.454f, 1.0f);
col.a = selected ? 0.6f : 0.2f;
Gizmos.color = col;
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawCube(Vector3.zero, Vector3.one);
col.a = selected ? 0.6f : 0.2f;
Gizmos.color = col;
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
Gizmos.DrawWireSphere(Vector3.zero + radiusCenter, radius); //I need to NOT scale :smile:
}
public void OnDrawGizmos()
{
DrawGizmo(false);
}
public void OnDrawGizmosSelected()
{
DrawGizmo(true);
}
Does anyone know how to prevent JUST line 11’s Gizmo from scaling?