Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetPlatformTextureSettings

Gets platform specific texture settings.
Read time 2 minutesLast updated 11 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

GetPlatformTextureSettings(string, int, TextureImporterFormat, int, bool)

Gets platform specific texture settings.
public bool GetPlatformTextureSettings(string platform, out int maxTextureSize, out TextureImporterFormat textureFormat, out int compressionQuality, out bool etc1AlphaSplitEnabled)

Parameters

platform

The platform for which settings are required (see options below).

maxTextureSize

Maximum texture width/height in pixels.

Format of the texture for the given platform.

compressionQuality

Value from 0..100, equivalent to the standard JPEG quality setting.

etc1AlphaSplitEnabled

Status of the ETC1 and alpha split flag.

Returns

Type

Description

boolTrue if the platform override was found, false if no override was found.

Remarks

The values for the chosen platform are returned in the "out" parameters. The options for the platform string are "Standalone", "Web", "iPhone", "Android", "WebGL", "Windows Store Apps", "PS4", "XboxOne", "Nintendo Switch" and "tvOS".

Examples

using UnityEngine;using UnityEditor;using UnityEngine.UI;using System.Collections;public class DisplayInfo : EditorWindow{ [MenuItem("PlatformSettings/GetSettingsForAndroid")] static void GetAndroidSettings() { string platformString = "Android"; int platformMaxTextureSize = 0; TextureImporterFormat platformTextureFmt; int platformCompressionQuality = 0; bool platformAllowsAlphaSplit = false; TextureImporter ti = (TextureImporter)TextureImporter.GetAtPath("Assets/characters.png"); if (ti.GetPlatformTextureSettings(platformString, out platformMaxTextureSize, out platformTextureFmt, out platformCompressionQuality, out platformAllowsAlphaSplit)) { Debug.Log("Found some overrides for platform: " + platformString); } }}

GetPlatformTextureSettings(string, int, TextureImporterFormat, int)

Gets platform specific texture settings.
public bool GetPlatformTextureSettings(string platform, out int maxTextureSize, out TextureImporterFormat textureFormat, out int compressionQuality)

Parameters

platform

The platform whose settings are required (see below).

maxTextureSize

Maximum texture width/height in pixels.

Format of the texture.

compressionQuality

Value from 0..100, equivalent to the standard JPEG quality setting.

Returns

Type

Description

boolTrue if the platform override was found, false if no override was found.

Remarks

The values for the chosen platform are returned in the "out" parameters. The options for the platform string are "Standalone", "Web", "iPhone", "Android", "WebGL", "Windows Store Apps", "PS4", "XboxOne", "Nintendo Switch" and "tvOS".

GetPlatformTextureSettings(string, int, TextureImporterFormat)

Gets platform specific texture settings.
public bool GetPlatformTextureSettings(string platform, out int maxTextureSize, out TextureImporterFormat textureFormat)

Parameters

platform

The platform whose settings are required (see below).

maxTextureSize

Maximum texture width/height in pixels.

Format of the texture.

Returns

Type

Description

boolTrue if the platform override was found, false if no override was found.

Remarks

The values for the chosen platform are returned in the "out" parameters. The options for the platform string are "Standalone", "Web", "iPhone", "Android", "WebGL", "Windows Store Apps", "PS4", "XboxOne", "Nintendo Switch" and "tvOS".

GetPlatformTextureSettings(string)

Gets platform specific texture settings.
public TextureImporterPlatformSettings GetPlatformTextureSettings(string platform)

Parameters

platform

The platform whose settings are required (see below).

Returns

Type

Description

TextureImporterPlatformSettingsA TextureImporterPlatformSettings structure containing the platform parameters.

Remarks

Returns the parameters for the chosen platform. The options for the platform string are "Standalone", "Web", "iPhone", "Android", "WebGL", "Windows Store Apps", "PS4", "XboxOne", "Nintendo Switch" and "tvOS".