With Unity 3.0, we now have per-platform overrides for some properties such as the texture compression settings (e.g. we can say max size=1024 for iPad but only 512 for Android).
But how can we access this from editor scripts? In scripts, all I see on Texture2D are the properties themselves, like the texture format. How can I set the format to something only for 1 platform from script? I use this to select a bunch of textures and do things like resize them or change their format in 1 shot because doing them 1 at a time literally takes hours.
Use a CustomImportSettings Script
Place this in the Editor folder in Unity
using UnityEngine;
using UnityEditor;
using System;
//Sets our settings for all new Models and Textures upon first import
public class CustomImportSettings : AssetPostprocessor
{
public const float globalScaleModifier = 0.0028f;
void OnPreprocessTexture()
{
TextureImporter importer = assetImporter as TextureImporter;
importer.textureFormat = TextureImporterFormat.ARGB32;
importer.isReadable = true;
importer.mipmapEnabled = false;
}
void OnPreprocessModel()
{
ModelImporter importer = assetImporter as ModelImporter;
importer.globalScale = globalScaleModifier;
//importer.globalScale = 1.0f;
importer.generateMaterials = ModelImporterGenerateMaterials.None;
}
}
If you look within the 3.0 Docs at:
file:///Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/TextureImporter.html
TextureImporter you will see some PlatformSpecific gets and sets. That should be what you need.