UIAtlasMaker.AddOrUpdate C# (CSharp) Method

AddOrUpdate() public static method

Add the specified texture to the atlas, or update an existing one.
public static AddOrUpdate ( UIAtlas, atlas, Texture2D tex ) : void
atlas UIAtlas,
tex UnityEngine.Texture2D
return void
    public static void AddOrUpdate(UIAtlas atlas, Texture2D tex)
    {
        if (atlas != null && tex != null)
        {
            List<Texture> textures = new List<Texture>();
            textures.Add(tex);
            List<SpriteEntry> sprites = CreateSprites(textures);
            ExtractSprites(atlas, sprites);
            UpdateAtlas(atlas, sprites);
        }
    }

Usage Example

コード例 #1
0
ファイル: PsdWidgeteer.cs プロジェクト: wonghungwing/FastGUI
    // AdjustPosition
    #endregion

    #region AddTexture2DToAtlas

    /// <summary>
    /// Adds a texture to the atlas, the sprite data
    /// </summary>
    /// <param name="texture"></param>
    /// <returns></returns>
    private static UISpriteData AddTexture2DToAtlas(Texture2D texture)
    {
        UIAtlasMaker.AddOrUpdate(NGUISettings.atlas, texture);

        // NGUI v3 now shows its own progress panel, so we have to clear it when it finishes
        EditorUtility.ClearProgressBar();

        // now re-show our progress bar
        PsdImporter.UpdateProgress(false);

        // return the sprite
        return(NGUISettings.atlas.GetSprite(texture.name));
    }
All Usage Examples Of UIAtlasMaker::AddOrUpdate