void DeleteSprite(string name) { GameObject temp = Instantiate(uiAtlas.gameObject) as GameObject; UIAtlas atlas = temp.GetComponent <UIAtlas>(); atlas.RemoveSprite(name); GameObject go = PrefabUtility.ReplacePrefab(temp, uiAtlas, ReplacePrefabOptions.Default); this.uiAtlas = go.GetComponent <UIAtlas>(); DestroyImmediate(temp); }
void DeleteSprite(string sprite) { Debug.Log("DeleteSprite"); GameObject go = Instantiate(this.uiAtlas.gameObject); UIAtlas uia = go.GetComponent <UIAtlas>(); if (uia.HasSprite(sprite)) { uia.RemoveSprite(sprite); GameObject last = PrefabUtility.ReplacePrefab(go, uiAtlas, ReplacePrefabOptions.Default); this.uiAtlas = last.GetComponent <UIAtlas>(); } DestroyImmediate(go); }