ImmediateModeShapeDrawer Sample Not Drawing
Hello!
Attempting to try out Shapes and I am unable to get ImmediateMode working correctly. Here are my steps:
1. Created a fresh Unity "Universal 2D" project
2. Installed Shapes 4.5.1
3. Create empty GameObject and attach ImmediateModeShapeDrawer script from example https://acegikmo.com/shapes/docs/#immediate-mode
No lines appear in the scene or game view, and no console errors appear. If I add a Debug.Log into the body of the `DrawShapes` method, it is never logged to the console. The GameObject is active.
If I modify the example script to be a MonoBehavior and use `OnRenderObject`, I can see the lines in the Scene View, but not Game View when running.
[ExecuteAlways]
public class ShapesDebug : MonoBehaviour
{
void OnRenderObject()
{
// set up static parameters. these are used for all following Draw.Line calls
Draw.LineGeometry = LineGeometry.Volumetric3D;
Draw.ThicknessSpace = ThicknessSpace.Pixels;
Draw.Thickness = 4; // 4px wide
// set static parameter to draw in the local space of this object
Draw.Matrix = transform.localToWorldMatrix;
// draw lines
Draw.Line(Vector3.zero, Vector3.right, Color.red);
Draw.Line(Vector3.zero, Vector3.up, Color.green);
Draw.Line(Vector3.zero, Vector3.forward, Color.blue);
}
}
Hopefully I'm just missing something simple here. Thanks in advance!
Thank you for the quick reply!
Apologies for not being clearer in my post -- the code snippet I shared is after having modified the example. That code snippet displays the lines in scene view, but not in the game view.
Here is the example script I am attaching to my gameobject, taken from the example, that does not render: