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
0
Question by disband85 · Dec 06, 2010 at 03:12 AM · 2dtextureiphoneplaneorthographic

2D plane not drawing texture correctly

Hi,

I'm new to Unity and trying to make a 2D game for iPhone. I'm using Sprite Manager 2 and have the camera set to orthographic with an orthographic size of 160 (for 480x320 landscape resolution).

I have a sprite that is 480x68 in size. I have applied the standard Sprite script from SM2 to the game object. When I play test the game, the camera looks right and the sprite looks correctly positioned, but the texture is slightly wrong. It has cut off a bit from the right side of the texture and stretched it. It also appears to be tiling slightly on the Y axis.

Screenshot of what the sprite looks like along with the settings I configured: alt text

Here is what the image should look like: alt text

How do I get the texture to appear correctly?

EDIT: Just noticed that you can't make out the settings, here they are: Width: 480 Height: 68 Lower Left Pixel: X: 0 Y: 67 Pixel Dimensions: X: 480 Y: 68

Comment
Add comment · Show 1
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 disband85 · Dec 06, 2010 at 03:22 AM 0
Share

I managed to fix this by changing the following values: Lower Left Pixel: X: 0 Y: 57 Pixel Dimensions: X: 500 Y: 58 However I would like to understand why this has fixed it, and find an algorithm for deter$$anonymous$$ing these values, rather than guessing them until it looks right.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by disband85 · Dec 09, 2010 at 02:46 AM

Yes, the texture is being wrapped around if it's too small for the size of the sprite. The problem is trying to find the right, exact size (pixel dimensions) for the texture to fit the sprite. After doing many sprites now, there seems to be no method for figuring this out apart from guessing. Basically I make the pixel dimensions the same size as width and height initially, then run in game and keep changing pixel dimensions until the texture fits properly. It seems to be completely random as to how much you need to change it (doesn't correlate to image size of your texture at all).

One thing I did notice is that most of the time, the lower left pixel Y should be the same as pixel dimensions Y. Changing the lower left pixel X and Y offsets the texture by the respective axis.

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 The_r0nin · Dec 06, 2010 at 05:51 AM

It appears that the top of your sprite is being wrapped-around to the bottom of your image. This could be a UV problem (where the UV's of your object are out of alignment) or a case where the sprite is not being aligned like you think is should. I don't know much about Sprite Manager 2, but perhaps the texture has been compressed? A power-of-2 texture size height might give you better results (but, then again, 58 isn't a power of two...)

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 disband85 · Dec 09, 2010 at 02:50 AM 0
Share

thanks for your suggestion. You're right in that the texture wraps around. I don't think the UV alignment is wrong, more like the wrong size (eg. 0 - 0.7 ins$$anonymous$$d of 0 - 1). $$anonymous$$aking the pixel dimensions powers of 2 didn't help.

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

Creating a 2D game using planes with textures 1 Answer

2d game for iphone, use pixel perfect or not? 0 Answers

2D car track method 1 Answer

2d Sprite Sheet on characters ruined in unity 1 Answer

iphone 2D settings 2 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