public void Remove() { if (!isAdded) { return; } GizmoDebug.RemoveGizmo(this); isAdded = false; }
public void Add() { if (isAdded) { return; } GizmoDebug.StartGizmo(this); isAdded = true; }
// this method is use to append data to List and initiate singleton if there is not such thing public static void StartGizmo <T>(T gizmoData) { #region init singleton if (singleton == null) { singleton = new GameObject("GizmoDebug").AddComponent <GizmoDebug>(); } #endregion #region Append Data to List if (gizmoData.GetType() == typeof(GizLineData)) // if gizmoData is a line { singleton._lines.Add(gizmoData as GizLineData); } else if (gizmoData.GetType() == typeof(GizBoxData)) // if gizmoData is a Box { singleton._boxes.Add(gizmoData as GizBoxData); } else if (gizmoData.GetType() == typeof(GizSphereData)) // if gizmoData is a Sphere { singleton._sphere.Add(gizmoData as GizSphereData); } #endregion }