Get Shapes 💖
 
Documentation
 
Changelog
 
Feedback
Bugs & Feature Requests

Shapes 4.3.1 2023-Sept-2

Hotfix

  • Fixed a namespace compilation error in URP/HDRP (#564)

Shapes 4.3.0 2023-Sept-1

Features

  • Added chevron/arrow dashes (#520)
  • You can now draw meshes using Draw.Mesh in the immediate mode API
    •     Useful when you want to inject a non-shapes render into immediate mode drawing
    •     The function accepts a custom material and optionally a material property block
    •     Render state (blend mode, stencil, ZTest...) or properties (color, thickness, radius...) won't apply to Draw.Mesh
  • Draw.Texture now supports GPU instancing
  • Added experimental ImmediateModeCanvas and ImmediateModePanel components
    •     Allows you to draw immediate mode shapes with the help of RectTransforms for positioning and layout
    •     For an example usage, see the new IMCanvas sample scene
    •     Note: Does not sort among standard UI panels, it is drawn entirely separately
  • Added ImmediateModeShapeDrawerEditor, for drawing Shapes from a custom inspector
  • Added a helper method for drawing shapes in IMGUI/editors: Draw.PrepareForIMGUI()

Fixes

  • Fixed polyline joins sometimes creating very long sharp protrusions (#90)
  • Fixed a bug where non-uniform scaling on disc parents had weird behavior (#299)
  • Fixed allocations in Polyline mesh generation (#286)
  • Fixed ToUpper not being culture invariant (#388)
  • Fixed allocations happening in RenderState.cs (#464)
  • Fixed a bug where end-to-end dashes improperly snapped (#471)
  • Fixed a bug where the polyline BezierTo method didn't create enough points (#479)
  • Removed square brackets from material names to make addressables happier (#509)
  • Fixed a bug where minimizing unity could cause memory leaks when drawing polylines or polygons
  • Fixed allocation issues with polylines and polygons
  • Fixed a bug where toggling gradient fill didn't update the colors correctly
  • Fixed various inline documentation issues

Shapes 4.2.1 2022-Aug-20

Hotfixes

  • Fixed a bug where reflection probes would break batching (#459)
  • Fixed a bug where SetInteger failed (#458)

Shapes 4.2.0 2022-Aug-20

Features

  • Added Draw.TextRect(), which lets you specify a rectangular region to draw text in
  • Added Draw.TextWrap
  • Added Draw.TextOverflow
  • Added support for all TextMeshPro alignment options (#323)
  • Added ColorMask support (#449)
  • Added new sample scene: Immediate mode color picker

Fixes

  • Text no longer allocates (#240)
  • Text is now ~10 times faster, or, ~140 times faster if you're using the new TextElement helper type
  • Fixed a bug where torus start/end angles didn't work in immediate mode (#404)
  • Fixed a bug where text drawing sometimes got a null ref exception
  • Fixed a bug where scene view gradient editing was broken
  • Polyline mesh generation is now more performant (#454)

Breaking Changes

  • Minimum Unity version is now 2019.4
  • Minimum TextMeshPro version is now 2.1.6
  • Text no longer supports custom depth/masking render states (removing this is part of what made the performance gain possible. This might change in the future)
  • Removed Draw.Text() overloads with angle and normal direction to save on the sheer amount of overloads

Shapes 4.1.3 2022-Feb-21

Hotfix

  • Had to to unclever my clever triangulation solution to make it triangulate more cleverly

Shapes 4.1.2 2022-Feb-21

Features

  • Added start & end angle for the torus (#389)
  • Added fog support

Changes

  • Replaced Consolas with Inconsolata (pls don't sue me microsoft I didn't know ;;)
  • Minor example scene lighting tweak

Fixes

  • Fixed a bug with first-time import in Unity 2021 and above, causing nullrefs (#386, #373)
  • Fixed a bug where Draw.Text would sometimes leave text in the scene (#152)
  • Fixed a bug where the turkish language made life harder (#388)
  • Fixed polygon triangulation issues (#390, #116)

Shapes 4.1.1 2021-Nov-28

Features

Changes

  • Auto-setting of render pipelines can now be disabled and overridden (#347)
  • Shapes sample assets are now in a separate assembly (#331)
  • Reduced line count for the procedural tree example scene

Fixes

  • Fixed an issue where URP render features were always forcefully added (#242, #341)
  • Fixed a bug where polygons & polylines didn't draw in the URP edit mode (#340)
  • Fixed a bug where setting component polyline joins from script didn't work (#348)
  • Fixed a bug where Draw.Text didn't draw fallback fonts

Shapes 4.1.0 2021-Aug-2

Features

  • Added Draw.Texture to the immediate mode API
    •     Set by Rect & UVs
    •     Set by Rect & FillMode (by StretchToFill/ScaleToFit/ScaleAndCropToFill)
    •     Set by Position, Size & SizeMode (by Width/Height/LongestSide/ShortestSide/PixelsPerMeter/Radius)
  • Added additional properties to Draw.Text
    •     Style (bold, italics, underline etc) (#313)
    •     Spacing (character, word, line & paragraph)
    •     Margins
  • Added support for setting RenderQueue in Shape components (#304)
    •     Note that as with all other render state settings, this will prevent the object from using GPU instancing

Fixes

  • Fixed a critical object pooling issue, that led to flickering and memory leaks with polylines and polygons (#301, #306, #307)
  • Fixed a bug where dashed rectangles using corner pivots looked all wonky
  • Fixed a bug where you couldn't set gradient fill in immediate mode (#294)
  • Fixed a bug where the about window's update check would spam errors if you didn't have an internet connection (#308)
  • Fixed a bug where PolylinePath/PolygonPath AddPoints didn't update the mesh (#300)
  • Compass.cs example script is now a little more readable
  • The Shapes Config object now has a button to open the settings window, instead of exposing all parameters (#297)

Shapes 4.0.2 2021-July-4

Fixes

  • Fixed a bug where rectangle borders would fill in immediate mode
  • Fixed a bug where various shapes wouldn't get dashed in immediate mode
  • Fixed a bug where FixedDashCount wasn't actually fixed
  • Fixed inconsistent inline documentation for dash properties

Shapes 4.0.1 2021-June-30

Fix

  • Fixed a critical bug where Shapes didn't compile for URP & HDRP (#293)

Shapes 4.0.0 2021-June-29

Features

Fixes

  • 1118 Draw.X overloads have now been removed, related to Dashed & Filled shapes, as well as disc gradients, to avoid permutation explosion among the overloads (more info below in the breaking changes section)
  • Fixed a critical bug with immediate mode polylines flickering when multiple cameras were rendering (#216, #223, #244, #259)
  • Fixed some shapes not being hollow on mobile (#285)
  • Fixed precision issue with Color Dodge & Color Burn blend modes
  • Somehow fixed color fill d3d11 warnings by doing the opposite of what stackoverflow told me to do
  • Fixed a bug where the triangle shader didn't compile for PS4 (#277)
  • Fixed some shaders not compiling for Vulkan (#266)

Breaking changes (Dashes)

  • DashStyle is now a struct instead of a class
  • Dashed shapes with coordinate scaling no longer retain dash count, but instead update them the same way it would when changing size/radius
  • DashStyle constructors and implicit casts have been removed:
  • // Old constructors, removed in 4.0.0:
    var myDashStyle = new DashStyle( float );
    var myDashStyle = new DashStyle( float, float );
    var myDashStyle = new DashStyle( float, type ); // etc.
    
    // New static DashStyle methods to easily create specific dash styles:
    var myDashStyle = DashStyle.FixedDashCount( DashType.Basic, count:8 );
    var myDashStyle = DashStyle.RelativeDashes( DashType.Basic, size:2f, spacing:1f );
    var myDashStyle = DashStyle.MeterDashes( DashType.Basic, size:1f, spacing: 1f );
  • Dashes are no longer drawn using named overloads in Draw.X, and instead use global state. You can use the Draw.DashedScope helper functions to temporarily set dashed state of draw calls
  • // Old methods, removed in 4.0.0:
    Draw.LineDashed( a, b );              // Uses global dashes
    Draw.LineDashed( a, b, myDashStyle ); // Uses the supplied dashes
    
    // New methods (temporarily dashed shapes):
    using( Draw.DashedScope() )              // Shapes in this scope will use the global dashes
    	Draw.Line( a, b );
    using( Draw.DashedScope( myDashStyle ) ) // Shapes in this scope will use the supplied dashes
    	Draw.Line( a, b );
    
    // New methods (setting dashes globally):
    Draw.UseDashes = true;        // Globally enables dashes
    Draw.DashStyle = myDashStyle; // Sets the global dash style
    Draw.Line( a, b );            // This will now be dashed, since dashes are on globally
    

Breaking changes (GradientFill, formerly known as ShapeFill)

  • GradientFill is now a struct instead of a class
  • GradientFills are no longer drawn using named overloads in Draw.X, and instead use global state. You can use the Draw.GradientFillScope helper functions to temporarily set dashed state of draw calls
  • // Old methods, removed in 4.0.0:
    Draw.PolygonFill( ..., myFill );
    Draw.PolygonFillRadial( ..., myFill );
    Draw.PolygonFillLinear( ..., myFill );
    
    // New static fill methods:
    var myFill = GradientFill.Linear(...);
    var myFill = GradientFill.Radial(...);
    
    // New methods (temporarily gradient filled shapes):
    using( Draw.GradientFillScope() )         // Shapes in this scope will use the global fill
    	Draw.Polygon( ... );
    using( Draw.GradientFillScope( myFill ) ) // Shapes in this scope will use the supplied fill
    	Draw.Polygon( ... );
    
    // New methods (setting gradient fill globally):
    Draw.UseGradientFill = true; // Globally enables fill
    Draw.GradientFill = myFill;  // Sets the global fill style
    Draw.Polygon( ... );         // This will now be filled, since fill is on globally
    

Breaking changes (Disc Coloring)

  • Draw.Disc/Ring/Arc/Pie now have gradient coloring as a DiscColor, instead of as separate functions
  • // Old methods, removed in 4.0.0:
    Draw.DiscGradientRadial( ... );
    Draw.ArcGradientAngular( ... );
    Draw.PieGradientBilinear( ... ); // etc.
    
    // New methods:
    Draw.Disc( ..., DiscColors.Radial(...) );
    Draw.Disc( ..., DiscColors.Angular(...) );
    Draw.Disc( ..., DiscColors.Bilinear(...) );
    Draw.Disc( ..., color ); // This still works in 4.0.0 - Color is implicitly cast to DiscColors

Breaking changes (Draw States)

  • Several draw style states (listed below) have now been unified. This makes the overhead of pushing/popping state cheaper, and I've found that in practice, having them separate is more annoying than useful
  • Draw.Radius is now shared for all shapes, we have moved past the need for:
    Draw.DiscRadius
    Draw.RegularPolygonRadius
    Draw.SphereRadius
  • Draw.RadiusSpace is now shared for all shapes, we have moved past the need for:
    Draw.DiscRadiusSpace
    Draw.RegularPolygonRadiusSpace
    Draw.TorusRadiusSpace
  • Draw.Thickness is now shared for all shapes, we have moved past the need for:
    Draw.LineThickness
    Draw.RingThickness
    Draw.RegularPolygonThickness
    Draw.RectangleThickness
    Draw.TriangleThickness
  • Draw.ThicknessSpace is now shared for all shapes, we have moved past the need for:
    Draw.LineThicknessSpace
    Draw.RingThicknessSpace
    Draw.RegularPolygonThicknessSpace
    Draw.RectangleThicknessSpace
    Draw.TriangleThicknessSpace
    Draw.TorusThicknessSpace
  • Draw.SizeSpace is now shared for all shapes, we have moved past the need for:
    Draw.CuboidSizeSpace
    Draw.ConeSizeSpace

Shapes 3.2.3 2021-April-4

Fix

  • Fixed even more arc issues because of course. it's not like it's my birthday or anything haha~ (#235)

Shapes 3.2.2 2021-April-4

Fixes

  • Fixed a bug where arcs & pies didn't support start angle being greater than end angle (#235)
  • Fixed a bug where discs, rings, pies & arcs didn't fully match the set radius (#235)
  • Fixed a bug where polylines & polygons always updated in immediate mode, even when not changed (#215)
  • Fixed a typo in Draw.Position & Draw.Position2D

Shapes 3.2.1 2021-April-2

Fixes

  • Fixed a bug where you couldn't make builds (#233)
  • Fixed a bug where selecting the child shape of a newly instantiated disabled parent object caused a null ref (#137)
  • Fixed a bug where shaders didn't compile for metal, because apparently metal thinks half precision is the same thing as float precision so of course we can't redefine functions haha that would be silly what are overloads even

Shapes 3.2.0 2021-April-2

Features

  • Triangles now support being hollow, with a specific thickness / thickness space
  • Triangles now support local anti-aliasing
  • Triangles now have a roundness parameter, for rounding its corners (#224)
  • Rectangles now support linear/radial gradient color fill (#22)
  • Rectangles now support thickness space when hollow (#43)

Fixes

  • Arcs & Pies now render with much less waste in fill rate, improving performance when you have many thin slices of either (#208)
  • Fixed a bug where immediate mode colors didn't take gamma correction into account (#203, #231)
  • Fixed a bug where hollow rectangles with 0 thickness were still visible (#104)
  • Fixed a bug where hollow rectangles allowed negative thickness
  • Fixed a bug where dashed lines, rings & arcs didn't properly update when changing thickness (#232)
  • Fixed a bug where the regular polygon gradient fill handles didn't show up
  • Fixed a bug where Shapes would sometimes flicker and change positions in immediate mode (#223)
  • ImmediateModeShapeDrawer now respects scene view layer visibility settings (#222)

Shapes 3.1.1 2021-March-16

Fixes

  • Fixed a critical bug with incorrect rendering with multiple Draw.Commands or when using more than 1023 shapes (#216)
  • Fixed a bug where the "high" quad interpolation setting didn't compile (#220)
  • Updated the polyline UI to fade the polyline point Z component when using Flat 2D geometry, to clarify that Z is unused (#219)

Shapes 3.1.0 2021-March-14

Features

  • Added a procedural tree sample scene
  • Added blend modes to the gallery scene (#201)
  • Added inline documentation all across Shapes
  • Added drawing matrix manipulation functions: Translate, Rotate & Scale
  • Added drawing matrix helper properties: Position, Rotation, Right/Up/Forward & LocalScale
  • Added Push, PushMatrix, PushStyle & PushColor, used to save draw states
  • Added Pop, PopMatrix, PopStyle & PopColor, used to load draw states
  • Added Scope, MatrixScope, StyleScope & ColorScope, designed to be used in using(...) statements, which automatically pushes, then pops as you leave the scope
  • Added draw overloads without position/rotation data to easily draw at the current drawing matrix with no computational overhead
  • Draw.Command will now, by default, push/pop the entire draw state, which means any static properties set inside, will only apply inside of that scope. This behavior can be disabled in the settings window
  • ImmediateModeShapeDrawer can now optionally use camera culling masks (#193)

Fixes

  • Immediate mode memory allocation reduced to 0 bytes (#209)
  • Immediate mode drawing functions no longer do a full Matrix4x4 multiply on every draw
  • Shaders using camera vectors and screen space sizing are now faster
  • Removed Draw.Rgb, Draw.SetColorOpacity, Draw.TemporaryColor and Draw.TemporaryOpacity. I totally forgot these even existed and they were never supposed to be in the 1.0 release
  • Cleaned up the API, making lots of things that used to be public, internal or private
  • Fixed a compiler error when making a build using HDRP (#195)
  • Fixed a bug where Shapes didn't support Unity's integrated version control (#197)
  • Fixed various render pipeline bugs with the included sample assets
  • Fixed a bug where screen space sizing was broken in VR in Unity 2020.2 (#142)
  • Fixed a bug where screen space sizing was inconsistent depending on where it was on screen (#213)
  • Fixed a bug where editor picking was broken when using the Noot thickness space
  • Fixed inline documentation for draw overloads sometimes having incorrect parameter setup
  • Fixed a bug where immediate mode drawing with custom render states didn't work
  • Fixed a bug where zero-length 3D lines didn't properly support screen space scaling (#207)
  • Fixed a bug where samples had to be included with the install to use ImmediateModeShapeDrawer (#200)
  • Fixed a bug where shape components sometimes wouldn't update properly in editor
  • Fixed a bug where polylinePath/polygonPath scopes outside a Draw.Command scope didn't work in the editor
  • Fixed various compiler warnings

Upgrade notes & breaking changes

  • Draw.Command will, by default, push/pop draw state when you enter/exit its scope. This means that setting draw states inside will no longer "leak" outside of that scope. However, if you've been doing this intentionally, then your code might not behave as expected. It's recommended to leave this on, but if you want to turn of the style push/pop in Draw.Command, you can do so in the settings window
  • Draw.SetColorOpacity and Draw.Rgb has been removed - use Draw.Color instead
  • Draw.TemporaryColor and Draw.TemporaryOpacity has been removed - use Draw.ColorScope instead
  • Some of the sample assets/scenes have been renamed, so, if you relied on that then I guess things might break? shrug

Shapes 3.0.0 2021-February-9

Features

  • Added GPU instancing support in immediate mode, when using the new Draw.Command (check out the docs for more info)
  • Stencil Buffer support (#121)
  • Added blend modes: Screen, Linear Burn, Color Burn, Color Dodge, Darken, Lighten & Subtract
  • Transparent shapes now support premultiplied alpha blending
  • 3D primitives now have configurable detail levels (#11)
  • Added settings window, replacing the old .cs/.cginc configs
  • You can now use immediate mode in Update(), though it's not recommended (#155)
  • Immediate mode Draw.X functions now have inline documentation
  • Added an ImmediateModeShapeDrawer type to make it easier to draw from MonoBehaviour scripts
  • Added a simple immediate mode drawing sample scene
  • Added Polyline/Polygon path ClearAllPoints()

Fixes

  • Fixed the overly complex base drawing functions being public
  • Fixed depth being ignored in HDRP/URP immediate mode (#133)
  • Fixed a bug where Draw.Text would ignore render state settings (#157)
  • Fixed MatchDashSpacingToSize not being exposed on shape components (#163)
  • Fixed meshOutOfDate being serialized
  • Fixed torus scaling bug (#129)
  • Fixed sample scene materials not working in URP/HDRP (#165)
  • Moved several editor only resources out of runtime resources
  • Rectangles with coordinate scaling will no longer stretch border thickness or corner radii (#185)

Upgrade notes & breaking changes

  • The new method of drawing in immediate mode involves using a Draw.Command, which will allow you to access all the features it provides. Please check out the immediate mode documentation for more info!
  • The new settings window replaces the old config .cginc/.cs files. This means your settings will not be saved - you might have to update your settings accordingly!
  • The most complex immediate mode drawing functions that had everything exposed are now private instead of public, which means you might have to change some code if you were using them. They didn't follow the same parameter order standard as the rest of the code, and they were inconsistent, weird, and confusing as they popped up in your autocomplete, and were never intended to be public in the first place. Any parameters you are missing from this change, can be set using the static properties instead

Shapes 2.3.2 2020-October-20

Features

  • Angled dash slope can now be tweaked and reversed (#113)
  • Inline code documentation for dash properties

Fixes

  • More shader optimization
  • Fixed a bug where immediate mode text wrapped (#122)
  • Fixed a bug where negative rectangle width/height misbehaved (#114)
  • Fixed a bug where 2D polylines used the incorrect bounds (#110)
  • Fixed a bug where Shape Group would get a nullref (#102)
  • Fixed a bug where parts of the cuboid inspector didn't work
  • Fixed a bug where polyline/polygon meshes didn't update properly (#47)
  • Fixed a bug where polygons sometimes failed to triangulate valid counter-clockwise configurations (#116)
  • Fixed a bug where setting zTest/factor/units in code of component-based polylines and polygons had no effect (#128)

Shapes 2.3.1 2020-September-15

Fixes

  • All shaders have been optimized further
  • Fixed a bug where regular polygons wouldn't compile on some platforms (#82, #91)
  • Fixed broken regular polygon scene view handles. They were like, straight up unfinished, I somehow forgot about it completely and so it was full of errors~
  • Fixed an issue where shape renderers would not be instanced due probe and shadow settings (#85)
  • Fixed a http request warning in Unity 2020.1+

Shapes 2.3.0 2020-September-8

Features

  • Added Regular Polygons! You can control the number of sides, roundness, whether or not it should be hollow, and more (#31)
  • Added Shape Group - A component that can color tint & alpha fade all child shapes (#74)
  • Discs can now be billboarded (always facing the camera) (#32)
  • You can now set depth test of all shapes (#51)
  • You can now set depth offset of all shapes (#17)

Fixes

  • Fixed a bug where discs has minor aliasing artifacts in each cardinal direction
  • Fixed a bug where scaled discs had incorrect thickness and transparency behavior (#76)
  • Fixed a bug where scaled polylines had incorrect transparency behavior (#66)
  • Gizmos are now auto-enabled when entering shape edit modes
  • Sorting layer and order properties are now accessible in code in shape components (#67)
  • Fixed an issue with first-time render pipe detection (#73)
  • Fixed FPS example in URP/HDRP
  • Namespaced two files I forgot to namespace!
  • Polyline/Polygon point lists are now exposed to users. note: this requires manual update of the mesh (#55)
  • Fixed nullref when modifying properties of disabled shapes (#56)
  • Minor UI tweaks

Shapes 2.2.0 2020-August-14

Features

  • URP support (#2)
  • HDRP support (#1)
  • Added Polygon shape, for making arbitrary filled polygons, with support for gradient overlay (#41)
  • Added scene view handles to modify shapes with

Fixes

  • Fixed a bug where polyline meshes didn't always update
  • Fixed a bug where scaling flat 2D lines behaved incorrectly
  • Fixed a bug where editing polyline thickness when multiselecting was a lil borked
  • Removed unnecessary [CreateAssetMenu] attributes

Shapes 2.0.0 2020-July-18

New dash features & changes

  • Added dashed Rings, Arcs & 3D Lines
  • Added dash Types: Basic, Rounded & Angled
  • Dash spacing can now be set independently of dash size
  • Dashes can now snap to the shape, either by tiling or having a dash at each end
  • Dash length can either be set in meters, relative to thickness, or a fixed count across the shape
  • Updated Shapes Gallery scene to include dashed examples

Other features

  • Added sorting layer & order to all shape components (#15)
  • Added setting to enable HDR for all color fields
  • Added Uniform and Coordinate scaling modes. Coordinate scaling scales objects without changing thickness values

Fixes

  • Cleaned up FPS example code
  • Updated Disc type & Line dash type UI icons to be more consistent
  • Fixed some inconsistencies with scaling (#4)
  • Fixed an issue where assigning certain fields on Line components don't work
  • Fixed a bug where the Polyline component did not update its mesh when assigning Polyline points by index
  • Fixed a bug where dashes for immediate mode lines didn't work (#25)

Shapes 1.1.1 2020-June-24

  • Fixed FPS example script preventing builds from compiling

Shapes 1.1.0 2020-June-23

  • Rectangles now support per-corner radius (#12)
  • Added the FPS HUD sample scene from the trailer
  • Added support for Unity 2018.4 LTS
  • Added offline quick start guide
  • Draw.Font now has a font assigned to it by default (Consolas)
  • Added a fancy about/check for updates window~
  • Polyline inspector now auto-collapses the point list if you have more than 20 points (case 18)
  • Shapes is no longer intended to go in Packages/ as we're now moving to the asset store
  • Fixed a bug where shapes were created in the scene instead of the prefab edit context (case 21)
  • Fixed a few incorrectly named properties (Disc.RadiusInner, Cone.RadiusSpace)
  • Fixed a bug where the dreaded cone didn't have support for single pass instanced rendering
  • Updated various shapes menu links

Shapes 1.0.1 2020-June-16

  • Added Draw.ResetStyle and Draw.ResetAllDrawStates for easy resetting/initialization of all statics
  • Fixed a critical path typo that somehow didn't break literally everyone's projects
  • Fixed a bug where you could add multiple Shapes to a single game object
  • Fixed a bug when modifying a Shape component before its Awake() was called (case #16)
  • Fixed a bug (hopefully) with single pass instanced VR (case #17)
  • Fixed tangent import warnings (case #15)
  • Removed unused UIElements using directive

Shapes 1.0.0 2020-June-13

  • Initial release on Patreon