Hello,
i want to create a levelgenerator with premade rooms. i want every room prefab to be stored with GetTilesBlock in an array.
Where can i save this array ? so i can use it later to create the rooms ? i tried to convert the tilearray to a string because i wanted to save the string in playerprefs. but how to i create a TileBase[ ] out of a string again ?
I think iam missing something.
And how can i reload this array? Can i export the TileBase[ ] in an asset ? Which i could reload later ? How to export it then ?
If i could create TileBase elements in unity i could create public TileBase[ ] and fill them via the inspector ?
Iam pretty new to coding. Thank you for your help and time!
Greetings
Justin
Hey Justin,
What you’re looking for is data serialization. Instead of trying to explain the process in entirety, I would highly recommend checking this page out in the Unity tutorials section. You’ll basically serialize the array, save it and reload as needed.
Thank you for that hint, i will try it out.
Ive managed to save my Object with an own created class into a json string and reload it. Thank you for the provided information.
Now i can create the level itself, how about Gameobjects to instantiate at a specific position of the Tilemap.
Should i rather take a “Custombrush” and add the gameobjects in there so i can use the normal coordinates of the tilemap. Or should i rather try to instantiate the Gameobject without the prefabbrush.
If iam using a prefabbrush, how can i execute the paint function on a specific tile with a specific brush ?
thank you very much