Determine the texture format at runtime.

Hello, I am trying to determine a texture format at runtime. It looks like the SDK doesn't expose textureFormat on the Texture or Texture2D object type. Is there any other way?

if(TextureFormat.ARGB32 == renderer.material.mainTexture.textureFormat) // compiler error
{
  print("It is a ARGB32 Texture");
}

1 Answer

1

You use Texture2D.format. If you look in the docs, you can see all the class variables and so on for Texture2D, so there's no need to guess.