Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by springfield2 · Sep 06, 2011 at 01:23 PM · resolutionmemory

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.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image springfield2 · Sep 20, 2011 at 10:17 PM 0
Share

Anyone with an answer to this?

avatar image jahroy · Sep 21, 2011 at 02:34 AM 0
Share

$$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.

avatar image timberlandboots · Sep 21, 2011 at 11:54 AM 1
Share

====( 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 )=====

3 Replies

· Add your reply
  • Sort: 
avatar image
1

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;
 }


Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Design3.com · Sep 22, 2011 at 08:50 PM 0
Share

updated answer with a potential editor scripting solution...

avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by springfield2 · Sep 23, 2011 at 04:31 PM

Genious! This is exactly what I was looking for! Thanks!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges