static void DrawGizmoForMyScript(GreasePencil instance, GizmoType gizmoType) { if (instance.layers != null) { for (int i = 0; i < instance.layers.Count; ++i) { if (instance.layers[i].enabled && (instance.layers[i].strokes != null)) { Handles.color = instance.layers[i].strokeColor; if (Handles.color.a > 0f) { for (int s = 0; s < instance.layers[i].strokes.Count; ++s) { Handles.DrawAAPolyLine(instance.layers[i].width, instance.layers[i].strokes[s].points.ToArray()); } } #if UNITY_5 Handles.color = instance.layers[i].fillColor; if (Handles.color.a > 0f) { for (int s = 0; s < instance.layers[i].strokes.Count; ++s) { Handles.DrawAAConvexPolygon(instance.layers[i].strokes[s].points.ToArray()); } } #endif } } } }
void OnEnable() { instance = target as GreasePencil; }