12using System.Collections.Generic;
30 [Tooltip(
"Should the gizmos be visible in the game view.")]
34 [Tooltip(
"Should the gizmos be visible in a build.")]
38 [Tooltip(
"The mesh to use for the filled sphere gizmo.")]
42 [Tooltip(
"The shader to use for rendering gizmos.")]
50 private bool _readyForSwap =
false;
99 tempMat.hideFlags = HideFlags.HideAndDontSave;
100 if (tempMat.passCount != 4) {
101 Debug.LogError(
"Shader " +
_gizmoShader +
" does not have 4 passes and cannot be used as a gizmo shader.");
106 assignDrawerParams();
132 assignDrawerParams();
146 private List<GameObject> _objList =
new List<GameObject>();
147 private List<IRuntimeGizmoComponent> _gizmoList =
new List<IRuntimeGizmoComponent>();
149 Scene scene = SceneManager.GetActiveScene();
150 scene.GetRootGameObjects(_objList);
151 for (
int i = 0; i < _objList.Count; i++) {
152 GameObject obj = _objList[i];
153 obj.GetComponentsInChildren(
false, _gizmoList);
154 for (
int j = 0; j < _gizmoList.Count; j++) {
163 }
catch (Exception e) {
164 Debug.LogException(e);
169 _readyForSwap =
true;
173 if ((camera.cullingMask & gameObject.layer) == 0) {
return; }
178 switch (camera.cameraType) {
179 case CameraType.Preview:
180#if UNITY_2017_1_OR_NEWER
181 case CameraType.Reflection:
184 case CameraType.Game:
209 _readyForSwap =
false;
217 bool isDisabled =
false;
220 if (toggle ==
null) {
224 if (!toggle.enabled) {
229 transform = transform.parent;
230 }
while (transform !=
null);
235 private void assignDrawerParams() {
252 private void generateMeshes() {
255 _cubeMesh.hideFlags = HideFlags.HideAndDontSave;
257 List<Vector3> verts =
new List<Vector3>();
258 List<int> indexes =
new List<int>();
260 Vector3[] faces =
new Vector3[] { Vector3.forward, Vector3.right, Vector3.up };
261 for (
int i = 0; i < 3; i++) {
262 addQuad(verts, indexes, faces[(i + 0) % 3], -faces[(i + 1) % 3], faces[(i + 2) % 3]);
263 addQuad(verts, indexes, -faces[(i + 0) % 3], faces[(i + 1) % 3], faces[(i + 2) % 3]);
267 _cubeMesh.SetIndices(indexes.ToArray(), MeshTopology.Quads, 0);
279 for (
int dx = 1; dx >= -1; dx -= 2) {
280 for (
int dy = 1; dy >= -1; dy -= 2) {
281 for (
int dz = 1; dz >= -1; dz -= 2) {
282 verts.Add(0.5f *
new Vector3(dx, dy, dz));
287 addCorner(indexes, 0, 1, 2, 4);
288 addCorner(indexes, 3, 1, 2, 7);
289 addCorner(indexes, 5, 1, 4, 7);
290 addCorner(indexes, 6, 2, 4, 7);
293 _wireCubeMesh.SetIndices(indexes.ToArray(), MeshTopology.Lines, 0);
307 float dx = 0.5f * Mathf.Cos(angle);
308 float dy = 0.5f * Mathf.Sin(angle);
310 for (
int j = 0; j < 3; j++) {
311 indexes.Add((i * 3 + j + 0) % totalVerts);
312 indexes.Add((i * 3 + j + 3) % totalVerts);
315 verts.Add(
new Vector3(dx, dy, 0));
316 verts.Add(
new Vector3(0, dx, dy));
317 verts.Add(
new Vector3(dx, 0, dy));
326 private void addQuad(List<Vector3> verts, List<int> indexes, Vector3 normal, Vector3 axis1, Vector3 axis2) {
327 indexes.Add(verts.Count + 0);
328 indexes.Add(verts.Count + 1);
329 indexes.Add(verts.Count + 2);
330 indexes.Add(verts.Count + 3);
332 verts.Add(0.5f * (normal + axis1 + axis2));
333 verts.Add(0.5f * (normal + axis1 - axis2));
334 verts.Add(0.5f * (normal - axis1 - axis2));
335 verts.Add(0.5f * (normal - axis1 + axis2));
338 private void addCorner(List<int> indexes,
int a,
int b,
int c,
int d) {
339 indexes.Add(a); indexes.Add(b);
340 indexes.Add(a); indexes.Add(c);
341 indexes.Add(a); indexes.Add(d);
351 private List<OperationType> _operations =
new List<OperationType>();
352 private List<Matrix4x4> _matrices =
new List<Matrix4x4>();
353 private List<Color> _colors =
new List<Color>();
354 private List<Line> _lines =
new List<Line>();
355 private List<WireSphere> _wireSpheres =
new List<WireSphere>();
356 private List<Mesh> _meshes =
new List<Mesh>();
359 private Matrix4x4 _currMatrix = Matrix4x4.identity;
360 private Stack<Matrix4x4> _matrixStack =
new Stack<Matrix4x4>();
362 private bool _isInWireMode =
false;
363 private Material _gizmoMaterial;
364 private int _operationCountOnGuard = -1;
368 if (_gizmoMaterial ==
null) {
371 return _gizmoMaterial.shader;
375 if (_gizmoMaterial ==
null) {
376 _gizmoMaterial =
new Material(value);
377 _gizmoMaterial.name =
"Runtime Gizmo Material";
378 _gizmoMaterial.hideFlags = HideFlags.HideAndDontSave;
380 _gizmoMaterial.shader = value;
391 _operationCountOnGuard = _operations.Count;
398 bool wereGizmosDrawn = _operations.Count > _operationCountOnGuard;
399 _operationCountOnGuard = -1;
401 if (wereGizmosDrawn) {
402 Debug.LogError(
"New gizmos were drawn to the front buffer! Make sure to never keep a reference to a Drawer, always get a new one every time you want to start drawing.");
410 matrix = transform.localToWorldMatrix;
417 _matrixStack.Push(_currMatrix);
424 matrix = _matrixStack.Pop();
431 matrix = Matrix4x4.identity;
443 if (_currColor == value) {
447 _operations.Add(OperationType.SetColor);
448 _colors.Add(_currColor);
460 if (_currMatrix == value) {
464 _operations.Add(OperationType.SetMatrix);
465 _matrices.Add(_currMatrix);
474 drawMeshInternal(mesh,
matrix);
480 public void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Vector3 scale) {
481 DrawMesh(mesh, Matrix4x4.TRS(position, rotation, scale));
489 drawMeshInternal(mesh,
matrix);
495 public void DrawWireMesh(Mesh mesh, Vector3 position, Quaternion rotation, Vector3 scale) {
496 DrawWireMesh(mesh, Matrix4x4.TRS(position, rotation, scale));
503 _operations.Add(OperationType.DrawLine);
504 _lines.Add(
new Line(a, b));
510 public void DrawCube(Vector3 position, Vector3 size) {
528 throw new InvalidOperationException(
"Cannot draw a sphere because the Runtime Gizmo Manager does not have a sphere mesh assigned!");
535 _operations.Add(OperationType.DrawWireSphere);
536 _wireSpheres.Add(
new WireSphere() {
539 numSegments = numSegments
556 Vector3 ellipseCenter = (foci1 + foci2) / 2f;
557 Quaternion ellipseRotation = Quaternion.LookRotation(foci1 - foci2);
558 var majorAxis = Mathf.Sqrt(Mathf.Pow(Vector3.Distance(foci1, foci2) / 2f, 2f)
559 + Mathf.Pow(minorAxis / 2f, 2f)) * 2f;
560 Vector3 ellipseScale =
new Vector3(minorAxis, minorAxis, majorAxis);
562 matrix = Matrix4x4.TRS(ellipseCenter, ellipseRotation, ellipseScale);
573 Vector3 up = (end - start).normalized * radius;
574 Vector3 forward = Vector3.Slerp(up, -up, 0.5F);
575 Vector3 right = Vector3.Cross(up, forward).normalized * radius;
577 float height = (start - end).magnitude;
580 DrawLineWireCircle(start, up, radius, 8);
581 DrawLineWireCircle(end, -up, radius, 8);
584 DrawLine(start + right, end + right);
585 DrawLine(start - right, end - right);
586 DrawLine(start + forward, end + forward);
587 DrawLine(start - forward, end - forward);
590 DrawWireArc(start, right, forward, radius, 0.5F, 8);
591 DrawWireArc(start, forward, -right, radius, 0.5F, 8);
592 DrawWireArc(end, right, -forward, radius, 0.5F, 8);
596 private void DrawLineWireCircle(Vector3 center, Vector3 normal,
float radius,
int numCircleSegments = 16) {
597 DrawWireArc(center, normal, Vector3.Slerp(normal, -normal, 0.5F), radius, 1.0F, numCircleSegments);
600 public void DrawWireArc(Vector3 center, Vector3 normal, Vector3 radialStartDirection,
601 float radius,
float fractionOfCircleToDraw,
int numCircleSegments = 16) {
602 normal = normal.normalized;
603 Vector3 radiusVector = radialStartDirection.normalized * radius;
605 int numSegmentsToDraw = (int)(numCircleSegments * fractionOfCircleToDraw);
606 Quaternion rotator = Quaternion.AngleAxis(360f / numCircleSegments, normal);
607 for (
int i = 0; i < numSegmentsToDraw; i++) {
608 nextVector = rotator * radiusVector;
609 DrawLine(center + radiusVector, center + nextVector);
610 radiusVector = nextVector;
614 private List<Collider> _colliderList =
new List<Collider>();
616 bool traverseHierarchy =
true,
617 bool drawTriggers =
false) {
620 if (traverseHierarchy) {
621 gameObject.GetComponentsInChildren(_colliderList);
623 gameObject.GetComponents(_colliderList);
626 for (
int i = 0; i < _colliderList.Count; i++) {
627 Collider collider = _colliderList[i];
630 if (collider.isTrigger && !drawTriggers) {
continue; }
639 bool skipMatrixSetup =
false) {
640 if (!skipMatrixSetup) {
645 if (collider is BoxCollider) {
646 BoxCollider box = collider as BoxCollider;
654 else if (collider is SphereCollider) {
655 SphereCollider sphere = collider as SphereCollider;
663 else if (collider is CapsuleCollider) {
664 CapsuleCollider capsule = collider as CapsuleCollider;
667 switch (capsule.direction) {
668 case 0: capsuleDir = Vector3.right;
break;
669 case 1: capsuleDir = Vector3.up;
break;
670 case 2:
default: capsuleDir = Vector3.forward;
break;
672 DrawWireCapsule(capsule.center + capsuleDir * (capsule.height / 2F - capsule.radius),
673 capsule.center - capsuleDir * (capsule.height / 2F - capsule.radius), capsule.radius);
676 Vector3 size = Vector3.zero;
677 size += Vector3.one * capsule.radius * 2;
678 size +=
new Vector3(capsule.direction == 0 ? 1 : 0,
679 capsule.direction == 1 ? 1 : 0,
680 capsule.direction == 2 ? 1 : 0) * (capsule.height - capsule.radius * 2);
684 else if (collider is MeshCollider) {
685 MeshCollider mesh = collider as MeshCollider;
686 if (mesh.sharedMesh !=
null) {
691 DrawMesh(mesh.sharedMesh, Matrix4x4.identity);
696 if (!skipMatrixSetup) {
711 public void DrawPosition(Vector3 pos,
Color lerpColor,
float lerpCoeff,
float? overrideScale =
null) {
713 if (overrideScale.HasValue) {
714 targetScale = overrideScale.Value;
719 var curCam = Camera.current;
720 var posWorldSpace =
matrix * pos;
721 if (curCam !=
null) {
722 float camDistance = Vector3.Distance(posWorldSpace, curCam.transform.position);
724 targetScale *= camDistance;
728 float extent = (targetScale / 2f);
730 float negativeAlpha = 0.6f;
733 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
734 DrawLine(pos, pos + Vector3.right * extent);
736 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
737 DrawLine(pos, pos - Vector3.right * extent);
740 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
741 DrawLine(pos, pos + Vector3.up * extent);
743 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
744 DrawLine(pos, pos - Vector3.up * extent);
747 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
748 DrawLine(pos, pos + Vector3.forward * extent);
750 if (lerpCoeff != 0f) {
color =
color.LerpHSV(lerpColor, lerpCoeff); }
751 DrawLine(pos, pos - Vector3.forward * extent);
770 this.
matrix = frame.localToWorldMatrix;
771 DrawLine(rect.Corner00(), rect.Corner01());
772 DrawLine(rect.Corner01(), rect.Corner11());
773 DrawLine(rect.Corner11(), rect.Corner10());
774 DrawLine(rect.Corner10(), rect.Corner00());
784 _wireSpheres.Clear();
786 _isInWireMode =
false;
787 _currMatrix = Matrix4x4.identity;
788 _currColor =
Color.white;
796 int wireSphereIndex = 0;
800 _currMatrix = Matrix4x4.identity;
801 _currColor =
Color.white;
803 GL.wireframe =
false;
805 for (
int i = 0; i < _operations.Count; i++) {
806 OperationType type = _operations[i];
808 case OperationType.SetMatrix:
809 _currMatrix = _matrices[matrixIndex++];
812 case OperationType.SetColor:
813 _currColor = _colors[colorIndex++];
817 case OperationType.ToggleWireframe:
818 GL.wireframe = !GL.wireframe;
821 case OperationType.DrawLine:
822 setPass(ref currPass, isUnlit:
true);
825 Line line = _lines[lineIndex++];
826 GL.Vertex(_currMatrix.MultiplyPoint(line.a));
827 GL.Vertex(_currMatrix.MultiplyPoint(line.b));
831 case OperationType.DrawWireSphere:
832 setPass(ref currPass, isUnlit:
true);
835 WireSphere wireSphere = _wireSpheres[wireSphereIndex++];
836 drawWireSphereNow(wireSphere, ref currPass);
840 case OperationType.DrawMesh:
842 setPass(ref currPass, isUnlit:
true);
844 setPass(ref currPass, isUnlit:
false);
847 Graphics.DrawMeshNow(_meshes[meshIndex++],
848 _currMatrix * _matrices[matrixIndex++]);
852 throw new InvalidOperationException(
"Unexpected operation type " + type);
856 GL.wireframe =
false;
860 private void drawLineNow(Vector3 a, Vector3 b) {
861 GL.Vertex(_currMatrix.MultiplyPoint(a));
862 GL.Vertex(_currMatrix.MultiplyPoint(b));
865 private void drawWireArcNow(Vector3 center, Vector3 normal,
866 Vector3 radialStartDirection,
float radius,
867 float fractionOfCircleToDraw,
int numCircleSegments = 16) {
868 normal = normal.normalized;
869 Vector3 radiusVector = radialStartDirection.normalized * radius;
871 int numSegmentsToDraw = (int)(numCircleSegments * fractionOfCircleToDraw);
872 Quaternion rotator = Quaternion.AngleAxis(360f / numCircleSegments, normal);
873 for (
int i = 0; i < numSegmentsToDraw; i++) {
874 nextVector = rotator * radiusVector;
876 drawLineNow(center + radiusVector, center + nextVector);
878 radiusVector = nextVector;
882 private void setCurrentPassColorIfNew(
Color desiredColor, ref
int curPass) {
883 if (_currColor != desiredColor) {
884 _currColor = desiredColor;
885 setPass(ref curPass, isUnlit:
true);
889 private void drawPlaneSoftenedWireArcNow(Vector3 position,
890 Vector3 circleNormal,
891 Vector3 radialStartDirection,
893 Color inFrontOfPlaneColor,
894 Color behindPlaneColor,
897 float fractionOfCircleToDraw = 1.0f,
898 int numCircleSegments = 16) {
899 var origCurrColor = _currColor;
901 var onPlaneDir = planeNormal.Cross(circleNormal);
902 var Q =
Quaternion.AngleAxis(360f / numCircleSegments, circleNormal);
903 var r = radialStartDirection * radius;
904 for (
int i = 0; i < numCircleSegments + 1; i++) {
906 var onPlaneAngle = Infix.Infix.SignedAngle(r, onPlaneDir, circleNormal);
907 var nextOnPlaneAngle = Infix.Infix.SignedAngle(nextR, onPlaneDir, circleNormal);
908 var front = onPlaneAngle < 0;
909 var nextFront = nextOnPlaneAngle < 0;
911 if (front != nextFront) {
912 var targetColor =
Color.Lerp(inFrontOfPlaneColor, behindPlaneColor, 0.5f);
914 setPass(ref curPass, isUnlit:
true, desiredCurrColor: targetColor);
918 var targetColor = inFrontOfPlaneColor;
920 setPass(ref curPass, isUnlit:
true, desiredCurrColor: targetColor);
924 var targetColor = behindPlaneColor;
926 setPass(ref curPass, isUnlit:
true, desiredCurrColor: targetColor);
930 drawLineNow(r, nextR);
935 _currColor = origCurrColor;
938 private void drawWireSphereNow(WireSphere wireSphere,
940 var position = wireSphere.pose.position;
941 var rotation = wireSphere.pose.rotation;
943 var worldPosition = _currMatrix.MultiplyPoint3x4(position);
945 var dirToCamera = (Camera.current.transform.position - worldPosition).normalized;
946 var dirToCameraInMatrix = _currMatrix.inverse.MultiplyVector(dirToCamera);
949 drawWireArcNow(position, dirToCameraInMatrix, dirToCameraInMatrix.Perpendicular(),
950 wireSphere.radius, 1.0f,
951 numCircleSegments: wireSphere.numSegments);
954 var x = rotation *
Vector3.right;
956 var z = rotation *
Vector3.forward;
958 drawPlaneSoftenedWireArcNow(position, y, x, wireSphere.radius,
959 inFrontOfPlaneColor: _currColor,
960 behindPlaneColor: _currColor.WithAlpha(_currColor.a * 0.1f),
961 planeNormal: dirToCameraInMatrix,
962 curPass: ref curPass,
963 fractionOfCircleToDraw: 1.0f,
964 numCircleSegments: wireSphere.numSegments);
965 drawPlaneSoftenedWireArcNow(position, z, y, wireSphere.radius,
966 inFrontOfPlaneColor: _currColor,
967 behindPlaneColor: _currColor.WithAlpha(_currColor.a * 0.1f),
968 planeNormal: dirToCameraInMatrix,
969 curPass: ref curPass,
970 fractionOfCircleToDraw: 1.0f,
971 numCircleSegments: wireSphere.numSegments);
972 drawPlaneSoftenedWireArcNow(position, x, z, wireSphere.radius,
973 inFrontOfPlaneColor: _currColor,
974 behindPlaneColor: _currColor.WithAlpha(_currColor.a * 0.1f),
975 planeNormal: dirToCameraInMatrix,
976 curPass: ref curPass,
977 fractionOfCircleToDraw: 1.0f,
978 numCircleSegments: wireSphere.numSegments);
981 private void setPass(ref
int currPass,
bool isUnlit,
Color? desiredCurrColor =
null) {
983 bool needToUpdateColor =
false;
984 if (desiredCurrColor.HasValue) {
985 needToUpdateColor = _currColor != desiredCurrColor.Value;
986 _currColor = desiredCurrColor.Value;
991 if (_currColor.a < 1) {
997 if (_currColor.a < 1) {
1004 if (currPass != newPass || needToUpdateColor) {
1006 _gizmoMaterial.color = _currColor;
1007 _gizmoMaterial.SetPass(currPass);
1011 private void drawMeshInternal(Mesh mesh, Matrix4x4
matrix) {
1013 throw new InvalidOperationException(
"Mesh cannot be null!");
1015 _operations.Add(OperationType.DrawMesh);
1020 private void setWireMode(
bool wireMode) {
1021 if (_isInWireMode != wireMode) {
1022 _operations.Add(OperationType.ToggleWireframe);
1023 _isInWireMode = wireMode;
1027 private enum OperationType {
1036 private struct Line {
1039 public Line(Vector3 a, Vector3 b) {
1045 private struct WireSphere {
1047 public float radius;
1048 public int numSegments;
1052 public static class RuntimeGizmoExtensions {
1054 public static void DrawPose(
this RuntimeGizmos.RuntimeGizmoDrawer drawer,
1055 Pose pose,
float radius = 0.10f,
1056 bool drawCube =
false) {
1057 drawer.PushMatrix();
1059 drawer.matrix = Matrix4x4.TRS(pose.position, pose.rotation,
Vector3.one);
1061 var origColor = drawer.color;
1067 drawer.DrawPosition(
Vector3.zero, radius * 2);
1069 drawer.color = origColor;
1074 public static void DrawRay(
this RuntimeGizmos.RuntimeGizmoDrawer drawer,
1075 Vector3 position, Vector3 direction) {
1076 drawer.DrawLine(position, position + direction);
UnityEngine.Component Component
void DrawWireArc(Vector3 center, Vector3 normal, Vector3 radialStartDirection, float radius, float fractionOfCircleToDraw, int numCircleSegments=16)
void DrawPosition(Vector3 pos)
Draws a simple XYZ-cross position gizmo at the target position, whose size is scaled relative to the ...
void DrawColliders(GameObject gameObject, bool useWireframe=true, bool traverseHierarchy=true, bool drawTriggers=false)
void DrawWireCube(Vector3 position, Vector3 size)
Draws a wire gizmo cube at the given position with the given size.
const int SHADED_SOLID_PASS
void DrawWireSphere(Pose pose, float radius, int numSegments=32)
void DrawWireMesh(Mesh mesh, Vector3 position, Quaternion rotation, Vector3 scale)
Draws a wire gizmo mesh at the given transform location.
void PushMatrix()
Saves the current gizmo matrix to the gizmo matrix stack.
void DrawWireSphere(Vector3 center, float radius, int numSegments=32)
Draws a wire gizmo sphere at the given position with the given radius.
void DrawWireCapsule(Vector3 start, Vector3 end, float radius)
Draws a wire gizmo capsule at the given position, with the given start and end points and radius.
void RelativeTo(Transform transform)
Causes all remaining gizmos drawing to be done in the local coordinate space of the given transform.
void DrawCollider(Collider collider, bool useWireframe=true, bool skipMatrixSetup=false)
const int SHADED_TRANSPARENT_PASS
void DrawPosition(Vector3 pos, float overrideScale)
void PopMatrix()
Restores the current gizmo matrix from the gizmo matrix stack.
void DrawLine(Vector3 a, Vector3 b)
Draws a gizmo line that connects the two positions.
Matrix4x4 matrix
Sets or gets the matrix used to transform all gizmos.
void DrawCube(Vector3 position, Vector3 size)
Draws a filled gizmo cube at the given position with the given size.
void ResetMatrixAndColorState()
Resets the matrix to the identity matrix and the color to white.
void DrawRect(Transform frame, Rect rect)
void BeginGuard()
Begins a draw-guard. If any gizmos are drawn to this drawer an exception will be thrown at the end of...
const int UNLIT_TRANSPARENT_PASS
Color color
Sets or gets the color for the gizmos that will be drawn next.
void DrawMesh(Mesh mesh, Matrix4x4 matrix)
Draw a filled gizmo mesh using the given matrix transform.
const int UNLIT_SOLID_PASS
void DrawSphere(Vector3 center, float radius)
Draws a filled gizmo sphere at the given position with the given radius.
void DrawEllipsoid(Vector3 foci1, Vector3 foci2, float minorAxis)
Draws a wire ellipsoid gizmo with two specified foci and a specified minor axis length.
void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Vector3 scale)
Draws a filled gizmo mesh at the given transform location.
void DrawAllGizmosToScreen()
void EndGuard()
Ends a draw-guard. If any gizmos were drawn to this drawer during the guard, an exception will be thr...
void DrawWireMesh(Mesh mesh, Matrix4x4 matrix)
Draws a wire gizmo mesh using the given matrix transform.
void DrawPosition(Vector3 pos, Color lerpColor, float lerpCoeff, float? overrideScale=null)
Draws a simple XYZ-cross position gizmo at the target position, whose size is scaled relative to the ...
static bool TryGetGizmoDrawer(out RuntimeGizmoDrawer drawer)
Tries to get a gizmo drawer. Will fail if there is no Gizmo manager in the scene, or if it is disable...
static RuntimeGizmoDrawer _frontDrawer
virtual void OnValidate()
static bool areGizmosDisabled(Transform transform)
static Action< RuntimeGizmoDrawer > OnPostRenderGizmos
Subscribe to this event if you want to draw gizmos after rendering is complete. Doing gizmo rendering...
void onPostRender(Camera camera)
const string DEFAULT_SHADER_NAME
static RuntimeGizmoDrawer _backDrawer
const int CIRCLE_RESOLUTION
static bool TryGetGizmoDrawer(GameObject attatchedGameObject, out RuntimeGizmoDrawer drawer)
Tries to get a gizmo drawer for a given gameObject. Will fail if there is no gizmo manager in the sce...
This class controls the display of all the runtime gizmos that are either attatched to this gameObjec...
Have your MonoBehaviour implement this interface to be able to draw runtime gizmos....
void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
A position and rotation. You can multiply two poses; this acts like Matrix4x4 multiplication,...