In this tutorial series you will learn how you can create an ingame UI where your players can draw on a grid. We are going to use Unitys Tilemaps and there will be a lot of coding involved. You'll learn how you can add the UI with clickable buttons, how to show a preview where an item would be placed and of course you can place it. It will then be drawn onto a tilemap.
In the first part of this series I will explain the basic setup and by the end you can place items with a simple click. We will also use Unitys New Input System for the input handling. The UI will be created by hand but automated in another part of the series.
Part two will explain how you can create rectangles and lines via click and hold events, also done with the new Input System. In another episode we will assign those drawing styles to the categories the items belongs to, so that for example a wall will be always drawable as a line. For this part you will assign those values directly to every drawable item.
To combine items like a floor and a vase on top you need several tilemaps. In part three of the series we expand the code to support different tilemaps for different categories we draw. The tilemaps will be generated during game start and therefore help you with easy maintainability.
Part four shows you how to automate the UI. With a little bit more code and configuration your drawing buttons will spawn on game start. So you can easily expand the drawable objects without the need to add more annoying UI things.
Part 5: Deleting tiles with a "Tooling Feature" which will handle custom code for different use cases.
Part 6: You will learn methods how to restrict tile placement based on different criteria like environment or placed tiles on other tilemaps. This will prevent e.g. placement inside water or also placing e.g. walls on top of items.
Part 7: We will create an option for keeping a build history in memory. With an undo and a redo function we will be able to iterate through this history.
=========
💻 CODE: https://github.com/MichelleFuchs/InGa...
💬 DISCORD: / discord
❤ SUPPORT ME: / velvary
🎮 PLAY MY GAMES: https://velvary.itch.io/
🦜 TWITTER: / velvary1
💡 ...MORE TUTORIALS: / velvarygames
=========
Timestamps:
00:00 - Intro
00:32 - Adding a "PlaceType"
01:24 - Updating the Input Action
02:00 - Coding the Hold Event
03:39 - The Rectangle Drawing
07:37 - The Line Drawing
09:20 - Fix some Issues
11:17 - Thank you for watching :)