Skip to content

nukadelic/UnityQuickDraw

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Quick Draw

  • Draw 2D anti-aliased, GPU-instance-supported, 0 allocation shapes ( circle,line,arrow ) with one line of code in Unity
  • Draw Labels ( now supports vr single pass instancing )
  • Draw 3D Shapes ( somehow stable )

Unity_0c5m1izulq

Installation

Edit the manifest.json file located in the Packages folder of your unity project and add the follwing line to the list of dependencies:

"com.nukadelic.unityquickdraw": "https://github.com/nukadelic/UnityQuickDraw.git"

Draw can be noramally called within the update function :

...
void Update()
{
	Draw.matrix = transform.localToWorldMatrix;

	Draw.line( Vector3.zero , Vector3.forward , Color.red );
}

By default the render will only appear in play mode when calling draw methods from the update loop In order to render both in edit mode ( scene view ) and play mode you can add [ExecuteAlways] or [ExecuteInEditMode] , and subscribe draw function OnEnable and OnDisable , see example below :

[ExecuteInEditMode]
public class DemoQuickDraw : MonoBehaviour {
    void OnEnable() => QuickDrawStatic.Add(OnDraw);
    void OnDisable() => QuickDrawStatic.Remove(OnDraw);
    void OnDraw()
    {
        Draw.matrix = transform.localToWorldMatrix;

        Draw.label( Vector3.zero , "Label" , Color.white );
    }
}

Forked from Miguel Ferreira

About

Draw shapes (circle,line,arrow) with one line of code in Unity

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages