- Home /
How to keep native texture dimensions with Resources.Load()?
By default, Unity changes texture sizes to powers of 2. This behavior can be changed via the advanced Texture Importer Settings, i.e. by setting the texture type to "Advanced" and using "ToNearest" as the "Non Power of 2" setting. This suits when you are grabbing a texture in the Editor.
But what about when you are loading a texture with Resources.Load()
? By default Unity changes the dimensions to powers of 2. How do you keep the native texture dimensions in this case?
Answer by steakpinball · Mar 03, 2013 at 06:06 PM
Loading with Resources.Load
loads files which are in a Resources folder in the unity project. Once a texture is in the project the import settings can be edited like any other texture.
http://docs.unity3d.com/Documentation/Manual/LoadingResourcesatRuntime.html
Thanks $$anonymous$$. I tried that. I set the texture import settings in my project before loading via a script. But it seems Unity only follows those settings in Editor, not in scripts?
Once a texture is imported it does not change. A script loading a texture may need to take more steps to properly use the texture depending on what it is being used for.
Your answer
![](https://koobas.hobune.stream/wayback/20220613093727im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
Resources.Load texture problem 1 Answer
Render GUI elements to off screen camera 1 Answer
Layered Textures/Materials 0 Answers
How to Make a Character Flicker? 1 Answer