Reading time: 4 minutes
In today’s post, I’m going to show you how we can create a surface using Unity.
I’ve used this image that you can download here (it is licensed under CC0, created/distributed by Kenney (www.kenney.nl)):
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/image-18.png?resize=360%2C162&ssl=1)
We’re going to copy this .png image into the Sprites folder (Assets > Sprites) in our Unity project. If we don’t have the folder, we create it.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-12.png?resize=404%2C208&ssl=1)
To split the tile, we can use the Unity editor. To do this, click on the tiles_packed image and in the options that appear on the right, click on Sprite Editor.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-13.png?resize=346%2C159&ssl=1)
Now, inside the editor, click on the second arrow pointing downwards next to Sprite Editor and select:
- Type: Grid by Cell Count
- Column & Row: C: 19 R: 10
And click on Slice.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-15.png?resize=367%2C297&ssl=1)
Now click on Apply and exit the editor.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-16.png?resize=399%2C100&ssl=1)
We can verify that it has been split in the Sprites viewer (Assets > Sprites) where we had the original image.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-17.png?resize=725%2C175&ssl=1)
Now let’s place the surface in the scene. To do this, go to Hierarchy and right-click inside to create a new element 2D Object > Tilemap > Rectangular.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07imagen-18.png?resize=643%2C406&ssl=1)
Now, to draw the floor on the surface, open the tab in the top options of Unity Window > 2D > Tile Palette.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-19.png?resize=372%2C457&ssl=1)
The Tile Palette editor will open.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-20.png?resize=283%2C451&ssl=1)
Click on Create New Palette, give it a name, and leave the rest of the fields as default.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-21.png?resize=349%2C217&ssl=1)
Click on Create and choose the path to save it. In this case, let’s create or choose a folder called tiles (Assets > Tiles).
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-23.png?resize=531%2C158&ssl=1)
Now we can see our element inside this folder Assets > Tiles.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-24.png?resize=258%2C159&ssl=1)
Now open the Assets > Sprites folder and drag tiles_packed into the right editor, Tile Palette.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-25.png?resize=527%2C345&ssl=1)
It will ask again where we want to save it, so we choose the Assets > Tiles folder again.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-26.png?resize=398%2C232&ssl=1)
Once saved, we have created the palette generated with our floor image.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-27.png?resize=237%2C384&ssl=1)
Now go back to Hierarchy and select the element we created earlier (inside Grid). I renamed it as Suelo (Floor).
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-28.png?resize=363%2C258&ssl=1)
Once selected, we can paint it using the created palette.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-29.png?resize=501%2C144&ssl=1)
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-30.png?resize=275%2C345&ssl=1)
If the elements appear too small like the ones in my image, we can make them larger. To do this, go back to Assets > Sprites and click on tiles_packed.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-31.png?resize=374%2C211&ssl=1)
Now choose Pixels Per Unit: 16.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-32.png?resize=338%2C380&ssl=1)
This way, the elements will fit the screen size.
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2022/07/imagen-33.png?resize=434%2C274&ssl=1)
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2023/07/cropped-light_logo-5.png?resize=100%2C100&ssl=1)