コード例 #1
0
    public static Texture2D GetSimpleColorTexture(Color color)
    {
        Texture2D texture;

        if (!SimpleColorTextures.TryGetValue(color, out texture))
        {
            texture = new Texture2D(1, 1);
            texture.SetPixel(0, 0, color);
            texture.Apply();
            texture.filterMode = FilterMode.Point;
            SimpleColorTextures.Add(color, texture);
        }
        return(texture);
    }
コード例 #2
0
    public static Texture2D GetSimpleColorTexture(int width, int height, Color color)
    {
        Texture2D texture;

        if (!SimpleColorTextures.TryGetValue(color, out texture))
        {
            texture = new Texture2D(width, height);
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    texture.SetPixel(x, y, color);
                }
            }

            texture.Apply();
            texture.filterMode = FilterMode.Point;
            //SimpleColorTextures.Add(color, texture);
        }
        return(texture);
    }