void SetClipboardComponent(Component selCom) { m_CopyCloneGameObject = NgObject.CreateGameObject(gameObject.transform, selCom.gameObject.name); NgObject.SetActiveRecursively(m_CopyCloneGameObject, false); m_CopyCloneObject = NgSerialized.AddComponent(m_CopyCloneGameObject, selCom); NgSerialized.CopySerialized(selCom, (m_CopyCloneObject as Component)); }
public static Component CloneComponent(Component srcCom, GameObject targetGameObj, bool bRemoveSrcCom) { Component tarCom = NgSerialized.AddComponent(targetGameObj, srcCom); NgSerialized.CopySerialized(srcCom, tarCom); if (bRemoveSrcCom) { Object.DestroyImmediate(srcCom); } return(tarCom); }
public static Component ObjectCopy(Component src, Transform dstSelTrans, Object dstSelObj, bool bCreateNewTarget, bool bSearchTarComponent, bool bCopyAllTarComs) { Component[] tarComs = null; Component retCom = null; // bCreateNewTarget ���̿���, bSearchTarComponent ���̸� ���� �������� if ((bCreateNewTarget == false) && src.GetType() == dstSelObj.GetType()) // �űԻ��� ������ �ƴϸ�, �����Կ� ����� { // if (NgAssembly.IsValidCopy(dst, src)) { tarComs = new Component[1]; tarComs[0] = dstSelObj as Component; } } else { if (bSearchTarComponent) { tarComs = dstSelTrans.GetComponents(src.GetType()); } } if (tarComs == null || tarComs.Length <= 0) // ���� ������ { tarComs = new Component[1]; tarComs[0] = NgSerialized.AddComponent(dstSelTrans.gameObject, (src as Component)); } if (tarComs != null) { foreach (Component tarcom in tarComs) // ���� ���� { if (src != tarcom) { NgSerialized.CopySerialized(src as Component, tarcom); FXMakerHierarchy.inst.OnAddComponent(tarcom); retCom = tarcom; if (bCopyAllTarComs == false) { break; } } } } return(retCom); }
public static Component ObjectCopy(Component src, Transform dstSelTrans, Object dstSelObj, bool bCreateNewTarget, bool bSearchTarComponent, bool bCopyAllTarComs) { Component[] tarComs = null; Component retCom = null; // bCreateNewTarget ツ?タフソゥオオ, bSearchTarComponent ツ?タフク?サ?キホ サ?シコセネヌヤ if ((bCreateNewTarget == false) && src.GetType() == dstSelObj.GetType()) // スナアヤサ?シコ チカーヌタフ セニエマク? ーータコーヤソ。 オ蠍?チ゚ { // if (NgAssembly.IsValidCopy(dst, src)) { tarComs = new Component[1]; tarComs[0] = dstSelObj as Component; } } else { if (bSearchTarComponent) { tarComs = dstSelTrans.GetComponents(src.GetType()); } } if (tarComs == null || tarComs.Length <= 0) // セ?エル ククオ鯊レ { tarComs = new Component[1]; tarComs[0] = NgSerialized.AddComponent(dstSelTrans.gameObject, (src as Component)); } if (tarComs != null) { foreach (Component tarcom in tarComs) // ウサソ?コケサ? { if (src != tarcom) { NgSerialized.CopySerialized(src as Component, tarcom); FXMakerHierarchy.inst.OnAddComponent(tarcom); retCom = tarcom; if (bCopyAllTarComs == false) { break; } } } } return(retCom); }