9-Slice Tiled sprite in 2d game ? How ?
Hi guys, I'm making simple 2d game that is an clone of the classic arkanoid game. I want to make the paddle to have dynamic width. I've made the sprite inside photoshop, and want to make it be dynamic. I know i can do this if my paddle is inside a canvas and there i can use the 9-slice feature to make the middle stretch, but i want to do it without using canvas.
Do you have any idea how i can achieve this ?
Here is an screenshot of the paddle. I want the middle to tile itself and the left and right sides of the paddle to stay the same.
You probably need a canvas. Set the Canvas Render $$anonymous$$ode to World Space.
@hoekkii yeah i've done it with canvas, but i am not sure that this is the right way of doing it, because now i have canvas image that has boxCollider2D attached to it and it has physics logic also.
You can just add rigidbodies and colliders to canvasrenderers.
Answer by Ultroman · Nov 02, 2017 at 10:02 PM
You can make the sprite 9-sliced and enable "Auto Tiling" on your BoxCollider. No need for canvases. You should not use a canvas for your game objects. It's for GUI and "special occasions".