Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Oinobareion · Dec 23, 2010 at 01:09 PM · textureheightwidthdistort

"Non power of 2" Textures - How to access original size?

Hi,

I am building some kind of virtual museum with Unity. All the original paintings I want to show are not power of 2, so I chose the option "toSmaller" in the Texture Importer to keep the performace high. The problem is: Within the game, I also want to show the paintings as 2D Textures, so I will have to access their original texture width and height. By now, the paintings are distorted, because the textures are saved as 512 x 1024 or something like this. So, a statement like:

print("Size is " + painting.width + " by " + painting.height);

gives me 512 x 1024, but not the original size. Is it possible to access the texture's origial size?

Comment
Add comment · Show 2
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 Justin Warner · Dec 23, 2010 at 01:43 PM 0
Share

Well, what's the file type before you put it in to Unity? Can't you just check the old files?

avatar image Oinobareion · Dec 23, 2010 at 03:20 PM 0
Share

The file type is jpg. $$anonymous$$y problem is, how can I check the original file's dimensions during runtime?

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by taoa · Dec 23, 2010 at 03:18 PM

I would set those texture as 'GUI' so that they don't get resized at all. But if you absolutely need them to be power of 2 for memory usage issues, then got for the duplication solution, have one version 'power of 2' and one version 'GUI', switch to the latter when you're going for quality.

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
1

Answer by Oinobareion · Dec 24, 2010 at 01:26 PM

I am not sure, what you mean by setting the texture as 'GUI'. Can you explain that? Thanks a lot!

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 johan-skold · Feb 02, 2011 at 07:31 PM 0
Share

If you click the file in the project pane in Unity, you get import options for that texture in the inspector. Under "Texture Type", there's an option called "GUI". If you select that, Unity will not resize your texture at all.

avatar image
0

Answer by StephanK · Dec 23, 2010 at 01:46 PM

Easiest way to solve this is to duplicate the texture asset and set the power of 2 option to none, then use that one for your undistorted textures and the other one for the rest.

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

No one has followed this question yet.

Related Questions

Importing texture, problem with size - width and height get changed 3 Answers

Finding size of texture GUI 0 Answers

Having trouble tiling a shader over a plane instead of stretching 0 Answers

Is it better to enlarge an image by width/height or by scale? 0 Answers

Horizontal Bar 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