Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

The LoadTexture funtion looks like this, loading the texture from a file outside of the Unity asset system. When using the "T" to create a quad like you suggested, it's still creating an asset inside Unity, and I can't do this in my use case since the users can upload their own images at runtime.

Below the code in text form if you want to try it out - I just inserted my custom case below the case "<q=": section in the SuperTextMesh.cs.

 private Texture2D LoadTexture()

    {

        Texture2D texture = new Texture2D(2, 2);

string basePath = "D:\\Test\\";

        FileInfo fi = new FileInfo(Path.Combine(basePath, ParseText_myString + ".png"));

        if (fi.Exists)

        {

            if (texture.LoadImage(File.ReadAllBytes(fi.FullName)))

            {

            }

            else

            {

                // uh oh

            }

        }

        return texture;

    }

case "<em=":

                            ParseText_info.quadData = ScriptableObject.CreateInstance<STMQuadData>();

                            Texture2D texture = LoadTexture();

                            ParseText_info.quadData.texture = texture;

                            ParseText_info.quadData.filterMode = FilterMode.Trilinear;

                            ParseText_info.isQuad = true;

                            insertAfter = "\u2000";

                            break;


and the texture I am trying to load: