Beispiel #1
0
    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);
    }
Beispiel #2
0
    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);
    }