- Home /
Applying different textures depending on platform
Hello,
I'm working on a game object whose texture should differ depending on whether the game is being played on iPhone or iPad. What I do now is set the iPhone texture in the inspector and then in the Awake() function change the texture to the iPad one if iPad is the runtime platform. This change is done via Resource.Load. Does this mean that both textures get loaded into memory if I am playing on the iPad?
if yes, how do I avoid loading both textures. I realize that I don't have to set any texture in the inspector, but this is necessary in order for me to see the object in the scene when working on the game.
$$anonymous$$y guess is there's nothing to worry about.
I think the unused image won't be in memory once the app starts to run.
Presumeably it's not large enough to make a difference whether or not it's downloaded with the app.
I'd love to hear from a person who actually knows what they're talking about!
I know there's an example project available somewhere that shows some examples for best practices for multi-platform development. I've been meaning to check it out, but can't find it right now.
====( http://www.clothes6.us )=====
online store wholesale sneakers,Jerseys, jewelry, glasses, shirt, sports,handbags,clothes ,news, vogue,jeryse at ugg boots,luxury fashion ysl women boots, christian louboutin boots,ed hardy clothes, jordan shoes,nike shoes,hoodies,t-shirts,nfl jerseys,mlb jerseys,nhl jerseys,coach handbags,handbags,wholesale, retail, sunglasses,belts, caps, ed hardy caps,suit,fashion good,newest style goods All the products are free shipping,
====( http://www.clothes6.us )=====
free shipping
competitive price
any size available
accept the paypal
jordan shoes $32
nike shox $32
$$anonymous$$BT shoes 48
NFL jersys 24
NBA jersys 24
Timberland boots 45
Christan Audigier bikini $20
Ed Hardy Bikini $23
Smful short_t-shirt_woman $14
ed hardy short_tank_woman $15
Sandal $26
christian louboutin $60
Sunglass $14
COACH_Necklace $18
handbag $33
AF tank woman $16
====( http://www.clothes6.us )=====
Answer by Design3.com · Sep 21, 2011 at 02:22 AM
I think you already have your answer, just unlink the texture in the inspector right before you build and use the Awake function for logic on both textures.
Look here for more info: http://unity3d.com/support/documentation/ScriptReference/Resources.html
It looks like everything in the Resources folder gets loaded; you can use Resource.UnloadUnusedAssets to free up memory, but the texture will still get included in the build and increase the app's size.
I think you could also make a custom button or menu item using editor scripting and call a custom Build function that uses BuildPipeline.BuildPlayer. As part of that function you could unlink the connected texture.
in js:
@MenuItem ("Build/BuildIOSplayer")
static function Build() {
var tempTex : Texture2D = myTexVar;
myTexVar = null;
BuildPipeline.BuildPlayer( "Assets/Scene1", "myBuildPath", BuildTarget.iPhone, BuildOptions.None);
myTexVar = tempTex;
}
updated answer with a potential editor scripting solution...
Answer by springfield2 · Sep 21, 2011 at 10:40 AM
Ok. Thanks. I will do this. I wish there was an editor script, that could display a texture in the editor and unlink the texture automatically when building.
Answer by springfield2 · Sep 23, 2011 at 04:31 PM
Genious! This is exactly what I was looking for! Thanks!
Your answer

Follow this Question
Related Questions
Can I improve the resolution quality of a photosphere applied as texture to a 3d sphere gameobject? 1 Answer
Why image resolution changed after making atlas by using NGUI Altlas maker?[Solved] 1 Answer
how does screen resolution influence positions in unity? 0 Answers
Keep Aspect ratio/Letterbox and maintain pixel perfection 0 Answers
Screen.SetResolution causes screen to turn black (and other problems). Am I doing it right ? 1 Answer