- Home /
How can I make a simple sprite that I can stretch for different platforms?
Hi. I'm currently working on a platformer where all the platforms are styled with outlines like this: 
All the white is transparency btw.
These boxes make up the platforms which obviously need to be different sizes. The problem is, I don't know a good way to stretch a simple image like this without distorting it.
Does someone know a simple way that will let me replicate this look on multiple game objects of different sizes?
Please and thank-yous.
Answer by Umresh · Jul 06, 2015 at 05:49 AM
Use the following settings 

I'm sorry, i'm grateful for the simple fix, but i can't seem to get this to work. I've set up the image as as sprite and edited in the text editor. And then I made an empty game object and gave it he image (script) component which gave it the canvas render and the rect transform. Then i filled all the settings in.
But i can't see anything. If it helps, nothing is inside the image in the top left of the rect transform. Ins$$anonymous$$d of a green square holding a grey square that has the move compass symbol in it, i just see nothing in that box.

![]()
For your object to be considered as a UI item it needs to be under a canvas object.
Remove your GameObject from the scene. Go to the menu at the top, GameObject -> UI -> Image.
This will add all the necessary objects (Canvas, Image under Canvas and EventSystem). Then in the Image component of the Image, you can add the sprite.
Ahhh thank you very much! Solved all my issues. Sorry, i'm still a little new to some aspects of unity.
Never$$anonymous$$d. This was not helpful to me at all. As I said, these are for platforms, of a platformer. As in they cannot be UI elements.
Your answer
Follow this Question
Related Questions
Sprites and textures appears black on Samsung Galaxy Grand I9082 0 Answers
Texture type -> Advanced -> Mesh type: how it works? 1 Answer
Unity 2018 UGUI Android Sprite Textures Not Rendering Correctly 1 Answer
Draw some vectors over a sphere, just like latitude and longitudes with the help of 2D texture 0 Answers