private void AddItemByGameObject(GameObject go, int index) { string guid = UIToolManager.ObjectToGUID(go); if (string.IsNullOrEmpty(guid) == true) { string savePath = EditorUtility.SaveFilePanelInProject("Save prefab", go.name, "prefab", "Save prefab as ..."); if (string.IsNullOrEmpty(savePath) == true) { return; } go = PrefabUtility.CreatePrefab(savePath, go); guid = UIToolManager.ObjectToGUID(go); if (string.IsNullOrEmpty(guid) == true) { return; } } Item item = new Item(); item.gameObject = go; item.guid = guid; AddItem(item, index); }
private void AddItemByGUID(string guid, int index) { GameObject go = UIToolManager.GUIDToObject <GameObject>(guid); if (go != null) { Item item = new Item(); item.gameObject = go; item.guid = guid; AddItem(item, index); } }