- Home /
[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:
I have to give Height as a negative number (regardless of your co-ordindates, the property is called "height", so this seems screwed)
I cannot render the texture at less than 1 game unit (100 "pixels"), it just doesn't render
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).
![]()
Your answer