Unity : DrawTextureWithTexCoords Example and Tutorial

A few weeks earlier I was confused in how to use the DrawTextureWithTexCoords, searching with google gave no results, yes there are fews example and perhaps tips, but those are unclear to me.

Fortunatelly after trial and error, I finally understand how this function really works, stick to me for more explanation.

Unity Documentation :

DrawTextureWithTexCoords(Rect position, Texture image, Rect texCoords, bool alphaBlend = true);

Position : Rectangle on the screen to draw the texture within.
Texture : Texture to display.
texCoords : How to scale the image when the aspect ratio of it doesn’t fit the aspect ration to be drawn within.
alphablend : Whether to alpha blend the image on to the display (the default). If false, the picture is drawn on the display.

For more simple explanation,

Continue reading »

Unity : blue background when playing the scene


A few days ago, I got stuck in some problem.. it wasn’t so hard, the rendered game and executable unable to show me the background image, it’s just showing blue background and my sprite stuck in the middle.

Googling to find what the problem doesn’t show any results, until I got advice to restart unity… and problem was solved.

It seems unity had a bug that making the background image not showing in render game or executable compiled, the solution is actually simple, just restart the Unity and voila problem solved..

As for the sprite that stuck on center, just by check the root in the sprite solved the problem..

Oh yeah, I’m trying to learn how to use unity and blogging it as a reminder for many problem that may show up.. or just using it to store code library ?

Continue reading »