private void UpdateAtlasTexture()
        {
            if (atlas == null)
            {
                if (m_UVs.Count > m_Blitter.queueLength)
                {
                    // This can happen when the graphic device reloads.
                    m_ForceReblitAll = true;
                }

                atlas = CreateAtlasTexture();
                return;
            }

            if (atlas.width != m_Allocator.physicalWidth || atlas.height != m_Allocator.physicalHeight)
            {
                RenderTexture newAtlas = CreateAtlasTexture();
                if (newAtlas == null)
                {
                    Debug.LogErrorFormat("Failed to allocate a render texture for the dynamic atlas. Current Size = {0}x{1}. Requested Size = {2}x{3}.", atlas.width, atlas.height, m_Allocator.physicalWidth, m_Allocator.physicalHeight);
                }
                else
                {
                    m_Blitter.BlitOneNow(newAtlas, atlas, new RectInt(0, 0, atlas.width, atlas.height), new Vector2Int(0, 0), false, Color.white);
                }
                UIRUtility.Destroy(atlas);
                atlas = newAtlas;
            }
        }
        void UpdateAtlasTexture()
        {
            if (atlas == null)
            {
                atlas = CreateAtlasTexture();
                return;
            }

            if (atlas.width != m_CurrentSize.x || atlas.height != m_CurrentSize.y)
            {
                RenderTexture newAtlas = CreateAtlasTexture();
                if (newAtlas == null)
                {
                    Debug.LogErrorFormat("Failed to allocate a render texture for the dynamic atlas. Current Size = {0}x{1}. Requested Size = {2}x{3}.",
                                         atlas.width, atlas.height, m_CurrentSize.x, m_CurrentSize.y);
                }
                else
                {
                    m_Blitter.BlitOneNow(newAtlas, atlas,
                                         new RectInt(0, 0, atlas.width, atlas.height),
                                         new Vector2Int(0, 0), false, Color.white);
                }
                UIRUtility.Destroy(atlas);
                atlas = newAtlas;
            }
        }
Example #3
0
        private void UpdateAtlasTexture()
        {
            if (atlas == null)
            {
                if (m_UVs.Count > m_Blitter.queueLength)
                {
                    // This can happen when the graphic device reloads.
                    m_ForceReblitAll = true;
                }

                atlas = CreateAtlasTexture();
                return;
            }

            if (atlas.width != m_Allocator.physicalWidth || atlas.height != m_Allocator.physicalHeight)
            {
                RenderTexture newAtlas = CreateAtlasTexture();
                m_Blitter.BlitOneNow(newAtlas, atlas, new RectInt(0, 0, atlas.width, atlas.height), new Vector2Int(0, 0), false, Color.white);
                UIRUtility.Destroy(atlas);
                atlas = newAtlas;
            }
        }