• 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 $$anonymous$$gh. The problem is: Wit$$anonymous$$n 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 somet$$anonymous$$ng like t$$anonymous$$s. 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. My 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 t$$anonymous$$s 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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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 an issue with setting the minimum size for a field size 0 Answers

Exception: not implemented 1 Answer

How to get game resolution from PHP or where to find width and height in hexa code in Unity file format? 0 Answers


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