Hello Aron.
Unity 2020.3.22f1
BiRP
Drawing from within IDrawGizmos callback
Code:
using (Draw.WithColor(_color))
{
Draw.PushLineWidth(2F);
Draw.Circle(pos, Vector3.up, _circleRadius + 0.05F);
Draw.Circle(pos.With(y: MAX_HEIGHT ), Vector3.up, _circleRadius + 0.05F);
Draw.PopLineWidth();
}
using (Draw.WithMatrix(Matrix4x4Ext.New(pos.With(y: MAX_HEIGHT / 2F), Quaternion.identity, new Vector3(_circleRadius, MAX_HEIGHT, _circleRadius))))
{
//Draw.SolidMesh(GetCylinderMesh(), _color.WithAlpha(0.3F));
}
When SolidMesh() is commented
When uncommented
Several issues
- The shader on the mesh is transparent, even with alpha 1.
- The wire shader apparently inherits the alpha value of the mesh shader
Order of calls does not matter, the mesh is readable.
Whether matrix push is present or not doesnt change it.
Mesh is loaded from Editor/Resources by Resources.Load<> as singleton.
Also the matrix works, you can scratch it off the todo list.
UPD:
Yes something isnt clearing internally,
if you stop drawing the above code with a conditional in inspector
and switch to this afterwards
if(..)
Draw.WireBox(GetBoxBounds());
Draw.SolidBox(GetBoxBounds());
This happens
As you can see the wire is still orange. Even when the WithColor() is not executing.