- Home /
Platform strings used in SetPlatformTextureSettings()
I'm trying to make an Editor script that sets the platform specific texture settings. For that I need the strings of the platforms, but I can't find them anywhere.
textureImporter.SetPlatformTextureSettings("platform?", maxTextureSize, textureFormat);
Does anyone know them?
Thanks
Answer by jashan · Jan 04, 2012 at 05:17 PM
Here's some code for the options I know (these are confirmed to work - see details below for "Default" which needs to be handled differently):
private string[] platformOptions = new string[] {
"Default",
"Web",
"Standalone",
"iPhone",
"Android"
#if UNITY_3_5
, "FlashPlayer"
#endif
// Not sure what the precise strings are for these:
// Xbox 360
// PS3
// Wii
};
With "Default", you have to directly use TextureImporter.maxTextureSize and TextureImporter.textureFormat.
I've also posted a documentation bug (Case 434144 - TextureImporter - Platform strings missing in API). It's unfortunate they're not using an Enumeration for this instead of strings.
I agree about it being a shame there's no enum.
When I created my editor script (like the OP) I created my own enums to make the platform overrides appear as drop down choices in a ScriptableWizard.
It worked pretty well. Regardless, I think my wizard becomes obsolete with Unity 3.5.
Answer by Joe ByDesign · Mar 19, 2011 at 04:47 AM
iPhone Web Android (untested)
Would love to know how to get the "Default" TextureFormat value to work :)
Does anybody know the other strings for the other platforms? Specifically Standalone $$anonymous$$ac and Standalone PC...
Your answer
Follow this Question
Related Questions
Is there a #define for Build Settings Platform? 1 Answer
Default Texture Platform/Format settings 2 Answers
Import Image larger than 2048x2048 1 Answer
Are textured/z-clipped gizmos possible? 0 Answers
Adding textures to my maps? 2 Answers