Documentation: enhance first bit of code

Avatar
  • updated

it really isn't much but you can save beginners a lot of time by including

using UnityEngine;
using Shapes;

in the 

[ExecuteAlways] public class MyScript : ImmediateModeShapeDrawer {

public override void DrawShapes( Camera cam ){

using( Draw.Command( cam ) ){

// 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 );
}

}

}

Please do that 🙏

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline