public void Add <T>() where T : Component { if (Go == null) { Debug.LogError(GetType() + "/Add()/ current gameObject is null :" + Go.name); return; } Go.AddComponent <T>(); }
public T Add <T>() where T : Component { if (Go != null) { return(Go.AddComponent <T>()); } Debug.LogError("当前gameobject为空"); return(null); }
public SelectObject(string imageFileName, string text, Action onClick) { ButtonObject bo = new ButtonObject(imageFileName, text, onClick); Go = bo.Go; //加入Layout LayoutElement le = Go.AddComponent <LayoutElement>(); le.preferredHeight = _preferredHeight; }