InGame Tilemap Editing - PART 4: Automating the UI - 2D Level Builder - Unity Tutorial

Опубликовано: 04 Сентябрь 2021
на канале: Velvary
2,277
57

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.

Part 1: I explained 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 2: will explained how you can create rectangles and lines via click and hold events, also done with the new Input System. 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.

Part 3: 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. I will group the tilemap creation by category, so for every category it is possible to create an own tilemap. This can be adjusted as you wish by just usign the tutorial as an foundation.

Part 4: 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:27 - ScriptableObject: Create the UICategory
01:30​ - Combine UICategory with BuildingObjectBase
02:49 - Create the Script for Spawning the UI
03:40​ - Create the Prefabs for the UI
04:49 - Add the Prefabs to the Script
05:43 - Spawn the Categories
08:41 - Spawn the Items for the Categories
13:37 - Some more information
13:57 - Thank you for watching :)