public static void RegisterTreeManager() { if (GameObject.Find("_nodeTreeManager") == null) { CreateManager(); } TreeNodeManager = TreeNodeManager ?? GameObject.Find("_nodeTreeManager").GetComponent <TreeNodeManager>(); TreeNodeManager.RegisterGraph(curNodeGraph); }
public static void CreateManager() { var obj = GameObject.Find("_nodeTreeManager"); var cam = GameObject.Find("Canvas/drawline"); if (obj == null) { obj = new GameObject("_nodeTreeManager"); TreeNodeManager = obj.AddComponent <TreeNodeManager>(); TreeNodeGUIManager = obj.AddComponent <TreeNodeGUIManager>(); } if (cam == null) { cam = new GameObject("drawline", typeof(DrawLine)); var canvas = GameObject.Find("Canvas"); if (canvas == null) { throw new InvalidCastException("目前,需要一个名字为Canvas的UGUI_Canvas"); } cam.transform.SetParent(canvas.transform); cam.transform.localPosition = Vector3.zero; } }
void Awake() { TriggerEditorUtility.Init(); Instance = this; }