void ReplaceSelected() { if (m_TargetObject && m_SelectedObjects.Length > 0) { for (int i = 0; i < m_SelectedObjects.Length; i++) { GameObject oldGO = m_SelectedObjects[i]; GameObject newGO = Instantiate(m_TargetObject, oldGO.transform.position, oldGO.transform.rotation); newGO.transform.localScale = oldGO.transform.localScale; DestroyImmediate(oldGO); } } else { EF_Editor_Utils.DisplayDialogBox("Please Select Objects to replace or assign a GameObject to the target object!"); } }
public static void CreateUIGroup() { GameObject selectedGO = EF_Editor_Utils.GetSelectedObject(); GameObject uiGrp = (GameObject)AssetDatabase.LoadAssetAtPath("Assets/Emortal_Framework/Emortal_UI/Prefabs/UI_GRP.prefab", typeof(GameObject)); if (uiGrp) { GameObject curUIGrp = GameObject.Instantiate(uiGrp); curUIGrp.name = "UI_GRP"; if (selectedGO) { curUIGrp.transform.SetParent(selectedGO.transform); } } else { EF_Editor_Utils.DisplayDialogBox("Unable to Find the UI_GRP Prefab!"); } }