/// <summary>An Element is removed from it's previous Parent and Parented to this Element</summary> public CGElement AddChild(CGElement element) { if(element.GetParent() != null) element.GetParent().GetChildren().Remove(element); element.SetParentRaw(this); children.Add(element); return element; }
/// <summary>Modifies the Parent of the Element while adjusting the Children of the previous and new parent Elements</summary> public void SetParent(CGElement p) { try{ if (IsAboveInHierarchy(p)) { p.GetParent().GetChildren().Remove(p); p.SetParentRaw(parent); parent.GetChildren().Add(p); SetParent(p); } else { p.GetChildren().Add(this); if (parent != null) { parent.GetChildren().Remove(this); } parent = p; #if UNITY_EDITOR foldout = true; #endif } }catch (System.Exception e) { Debug.LogWarning("CreateGUI - \"" + name + "\" could not set parent \"" + p.name + "\" \n" + e.Message); } }
public CGElement AddElement(string baseName, CGElement parent) { CGElement element = ScriptableObject.CreateInstance(selectedElementType) as CGElement; Undo.RegisterCreatedObjectUndo(element, "CreateGUI Add Element"); element.name = baseName; element.SetParentRaw(parent); parent.GetChildren().Add(element); return(element); }
/// <summary>An Element is removed from it's previous Parent and Parented to this Element</summary> public CGElement AddChild(CGElement element) { if (element.GetParent() != null) { element.GetParent().GetChildren().Remove(element); } element.SetParentRaw(this); children.Add(element); return(element); }
/// <summary>Modifies the Parent of the Element while adjusting the Children of the previous and new parent Elements</summary> public void SetParent(CGElement p) { try{ if(IsAboveInHierarchy(p)){ p.GetParent().GetChildren().Remove(p); p.SetParentRaw(parent); parent.GetChildren().Add(p); SetParent(p); }else{ p.GetChildren().Add(this); if(parent != null) parent.GetChildren().Remove(this); parent = p; #if UNITY_EDITOR foldout = true; #endif } }catch(System.Exception e){ Debug.LogWarning("CreateGUI - \""+name+"\" could not set parent \""+p.name+"\" \n"+e.Message); } }