예제 #1
0
    public void RenderLayer()
    {
        if (texture == null || texture.width != size.x || texture.height != size.y)
        {
            if (texture != null)
            {
                Object.DestroyImmediate(texture);
            }
            texture            = new Texture2D(size.x, size.y, TextureFormat.RGBA32, false);
            texture.filterMode = FilterMode.Point;
            texture.hideFlags  = HideFlags.DontSave;
            layerUi.SetThumbnail(texture);
        }

        var pixels = new Color[size.x * size.y];

        foreach (var key in content.Keys)
        {
            if (IsIllegal(key))
            {
                continue;
            }

            pixels[key.x + key.y * size.x] = content[key];
        }

        texture.SetPixels(pixels);
        texture.Apply();
    }