Version: 1.3
LanguageEnglish
  • C#

TextureImporter.GetPlatformTextureFormat

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public TextureFormat GetPlatformTextureFormat(WebGLTextureSubtarget textureSubtargetFormat);

Parameters

textureSubtargetFormat The Subformat of the texture for the WebGL platform.

Returns

TextureFormat The texture should be convert into the target fomrat.

Description

Get the specific image format that the corresponding image of type global should be converted into.

using UnityEditor;
using System.IO;
using UnityEngine;

public class DisplayInfo { [MenuItem("TextureFormat/GetTextureFormatforASTC")] static void GetTextureFormat() { TextureImporter textureImporter = AssetImporter.GetAtPath("path/to/texture") as TextureImporter; var textureFormat = textureImporter.GetPlatformTextureFormat(WebGLTextureSubtarget.ASTC); UnityEngine.Debug.Log($"Get Texture Format {textureFormat} with WebGLTextureSubtarget.ASTC"); } }