コード例 #1
0
    public void AddTextToImageTexture(List <string> formattedText)
    {
        string charsWanted = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?";

        FontStyle.RequestCharactersInTexture(charsWanted, 16);
        Texture2D writting = new Texture2D(Image.width, Image.height, TextureFormat.ARGB32, false, true);

        FloodFillArea(writting, Image.width, Image.height, new Color(0, 0, 0, 0));

        WriteMultipleLines(writting, formattedText, 10, 20, 16);
        writting = FlipVertically(writting);

        //Use this to resize the first image, comment it out if not wanted
        //Does havea performance drop
        ResizeImage();
        //writting.Resize(Image.width, Image.height);

        //Image = writting;
        image = CombineTextures(Image, writting, 0, Image.height - writting.height);
        //TextToTexture ttt = new TextToTexture(FontStyle, 10, 10, null, false);
        //Image = ttt.CreateTextToTexture(formattedText, 10, 10, 2, 1, Image);
        //Image = ttt.CreateTextToTexture(formattedText, 10, 10, 150, 2, 1);
    }