I looked at the forums and found out that it is not recommended to use the terrain system for the mobile platform. So then I decided to have a single plane as a "terrain" with single ground color. But I want to implement that the player can draw on that plane different tiles by grid, for example, a road tile. Or should I make whole "terrain" by the tiles and just replace texture when player draw? Is there any other methods?
\$\begingroup\$ \$\endgroup\$
2 - \$\begingroup\$ If you want a grid of tile images, would the existing Tilemap component do the job? You can transform it to sit on the XZ plane instead of the default XY if you want it to be the ground of a 3D scene. \$\endgroup\$DMGregory– DMGregory ♦2023-02-26 01:26:50 +00:00Commented Feb 26, 2023 at 1:26
- \$\begingroup\$ You can simply rotate 2d tilemap 90 degrees to xz plane to use it in 3d. But doing so has a series of follow-up questions, such as "how to eliminate z-fighting?", "Why doesn't tilemap receive shadows?", welcome to ask new questions when you encounter these specific problems. \$\endgroup\$Mangata– Mangata2023-02-27 03:05:15 +00:00Commented Feb 27, 2023 at 3:05
Add a comment |
1 Answer
\$\begingroup\$ \$\endgroup\$
4 I didn't end up using unity's tilemap system, I did my own like this:
Create your map with game objects, each game object has a sprite of the tile graphic. You can change the tile sprite easily and as often as you like then.
- \$\begingroup\$ Keep in mind that this will have more overhead than the tilemap for large numbers of tiles. \$\endgroup\$2023-02-26 10:41:59 +00:00Commented Feb 26, 2023 at 10:41
- \$\begingroup\$ No it wont, because you only have as many tiles as your display can show (say 8x8=64 on a phone) and rather than scroll around a unity tilemap of 200x200 tiles, you update the 64 sprites with the right sprite by only using an int to store the tile type. Thats the old way large maps were done efficiently when memory was tight. \$\endgroup\$Ratbyte Boss– Ratbyte Boss2023-02-26 12:15:26 +00:00Commented Feb 26, 2023 at 12:15
- \$\begingroup\$ Then you're not dealing with "a large number of tiles" as I mentioned in my comment. If you have a game that needs to zoom out to show hundreds of tiles, doing that with individual game objects will have a noticeable performance overhead compared to the tilemap. \$\endgroup\$2023-02-26 14:08:08 +00:00Commented Feb 26, 2023 at 14:08
- \$\begingroup\$ Op doesn't mention "a large number of tiles" nor "zoom out to show hundreds of tiles" either. \$\endgroup\$Ratbyte Boss– Ratbyte Boss2023-02-28 09:57:57 +00:00Commented Feb 28, 2023 at 9:57