예제 #1
0
 /// <summary>
 /// Allows drawing of Gizmos outside of OnDrawGizmos flow
 /// </summary>
 /// <param name="drawFunc">
 /// A lambda expression containing relevant drawing code
 /// </param>
 /// <example>
 /// In some Main Thread function other than OnDrawGizmos
 /// <code>
 /// GizmosPlusAsync.DrawAsync(() => {
 ///     Gizmos.DrawLine(...);
 ///     GizmosPlus.DrawCross(...);
 /// });
 /// </code>
 /// </example>
 public static void DrawAsync(Action drawFunc)
 {
     if (drawer == null)
     {
         var go = new GameObject("_GizmosPlusAsyncDrawer");
         drawer = go.AddComponent <GizmosPlusAsyncDrawer>();
     }
     drawer.Enqueue(drawFunc);
 }
예제 #2
0
        private static GizmosPlusAsyncDrawer GetOrCreateDrawer()
        {
            if (drawer == null)
            {
                var go = new GameObject("_GizmosPlusAsyncDrawer");
                drawer = go.AddComponent <GizmosPlusAsyncDrawer>();
            }

            return(drawer);
        }