I’m creating a Twitch Chat Reader with support for twitch emotes. Players would download emotes which would then be packed into a generated texture atlas, which is then assigned to a TMP Sprite Asset that gets generated on runtime. All the generation works but when assigning the texture atlas to the Sprite Asset, I get a type mismatch. I’m able to assign the individual sprites to the Character and Glyph table and they are visible the first time the Sprite Asset is generated. I’m not sure whats causing this issue and changing up the atlas’s properties on initialization or casting it as just a Texture doesn’t fix the problem.
//This is for generating the sprite Asset
TMP_SpriteAsset spriteAsset = ScriptableObject.CreateInstance<TMP_SpriteAsset>();
spriteAsset.name = assetData.name;
Debug.Log(assetData.spriteData.Length);
spriteAsset.spriteSheet = atlasTexture as Texture;
spriteAsset.material = mat;
Debug.Log(spriteAsset.spriteSheet);
///This is for generating the atlas texture
Texture2D packedTexture = new Texture2D(totalTextureSize, totalTextureSize, TextureFormat.RGBA32, false, true)
{
filterMode = FilterMode.Bilinear,
wrapMode = TextureWrapMode.Clamp
};