Edit, Save And Load Unity Tilemaps At Runtime!

preview_player
Показать описание
In this tutorial I'm gonna show you how to create a level editor in Unity using it's built-in tilemap system. This part will showcase how you can place and remove tiles with your mouse, and how you can save those tilemaps at runtime to a json file.

You can download the project in this video from my github:

If you are interested in my projects you can join my discord or follow me on twitter. If you have any suggestions or ideas feel free to comment, or write in my discord channel.

Links:

Timestamps:
0:00 - Intro
0:22 - Preparing the project
0:43 - Actually doing some preparing
1:24 - Shameless self promotion
1:37 - Making a rule tile and some scripts
2:22 - Placing tiles
4:48 - Deleting tiles
5:18 - Spitting facts
5:28 - Saving levels
10:00 - You must exit play mode to save the scene
10:13 - Back to saving levels
10:26 - Battery problems
10:36 - Loading levels
12:05 - A perfectly working load function
13:00 - Ditching unity
15:17 - Dirt.
15:37 - Reducing the save file size
16:23 - The finished masterpiece
16:49 - Outro
Рекомендации по теме
Комментарии
Автор

Was mostly here for the saving and loading tilemap from a list because it wasn't working when I tried it. I had no idea Unity doesn't allow you to add null TileBases to lists lol
Thank you so much for this XD

Awesomeplayer
Автор

This time I tried something different. Instead of writing the entire script before recording I just opened up a new Unity project and just hit record. The video took more time to cut because all the mistakes I made (not preparing enough and cannot speaking english), but I think the result turned out pretty well. And I could even cut in some bloopers to make the video more interesting.

What do you think? Do you prefer scripted or this types of videos?

VinarkDev
Автор

I've been wondering about how to make a tilemap level editor for YEARS, but it's always seemed a bit too intimidating to get into, but thanks to this tutorial it suddenly feels a lot more possible. Thanks! :D

LeeMajorz
Автор

Just a note, but for people unfamiliar with JSON format, you can also achieve a similar result by storing the level data as XML with the built-in utility.

philbateman
Автор

0:12 when will you start your tutorial series i have been waiting too long 🔥😬

hmed.Jama
Автор

or a List<> of LevelData {string, int, int} and then related items will appear next to each other in the save file...

i-make-robots
Автор

how do i add support for multiple tiles of different kinds on the same tilemap because it only works with the first one you put in

BobbeDev
Автор

Hi
I have a question real quick
Can i use the tool in unity 2018.3.3 version?
Because I try it and it doesn't show up in the editer
Thanks
And nice work by the way 👍

icesteel
Автор

Wouldn't it be more prudent to store the TileBase objects somewhere else and assign them some kind of type ID, then just have a list of type ids in LevelData instead of a list of TileBase?

themrfj
Автор

Here is a problem with this - you have everything here, except the RuleTiles have multiple random variant sprites which it could be.. How to save/load the variant sprite for each RuleTile?
I figured out to get sprite - you can use Tilemap.GetSprite and save
But no idea how to load RuleTile with the sprite.. cuz when you add RuleTile to tilemap it selects random sprite.. Do you know how to do this?

ultimatesin
Автор

Hi! i have this error: object not set to an instance of an object in Load function at tilemap.SetTile. What couild be the cause of this. i cant figure out what isn't getting referenced.

jonttu