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 DanTup · Jan 06, 2014 at 10:46 PM · 2dbugtileunit

[Bug?] How do I draw textures less than 100px with Graphics.DrawTexture?

I'm working on a 2D tile-based game in Unity 4.3, but I'm struggling to render some basic tiles using Graphics.DrawTexture()...

My texture is a 70x70px texture (I had a spritesheet, but that was screwed, so I'm simplifying). It's set to "100 pixels per unit".

When I try to render the texture using Graphics.DrawTexture, I see some strange effects:

  1. I have to give Height as a negative number (regardless of your co-ordindates, the property is called "height", so this seems screwed)

  2. I cannot render the texture at less than 1 game unit (100 "pixels"), it just doesn't render

  3. All sizes "snap" to the nearest game unit, and not consistently (eg. trying to draw 1.5x1.5 results in a 2x1 tile, but 2.5x2.5 results in a 2x2 tile!)

I've spent the last few hours searching the web (and this site) and found no solutions. Am I misunderstanding something? Should it be this difficult to render a texture at less than 1 game unit with the default 100px = 1 game unit?

Here's a screenshot of my code, trying to render 5 copies of the tile; at square sizes of 0.5, 1, 1.5, 2, 2.5 game units, along with a screenshot of what gets rendered (the first one is missing, and everything else snaps to game units).

Rendering tiles at wonky sizes

unity pixel wtf.png (89.7 kB)
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The tile edges are blurred 4 Answers

Why do I get those green lines? 0 Answers

2D/Orthographic Tile Alignment Issue 0 Answers

Incomprehensive auto death on 2D runner with energy depleting mechanics [Debugging] 1 Answer

Drawing interconnected sprites among the line in 2D. 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