Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by GMihai · Aug 12, 2018 at 11:04 AM · tilemaprenderer2d spritestile

Tilemap Renderer problem generating random sprite Tiles

Hello, I`m trying to generate random tiles on a huge tilemap but changing the tile sprite seems to cause render problems. Also I have been playing a lot with the chunkSize, picking a small x value causes render problems and also picking a big y chunk size crashes unity. I`m currently using max size on x:512 and on y:1

This is a simple random sprite function I`m using :

 void RandomTile()
 {
     if (Random.value < 0.5f)
     {
         selectedtile.sprite = grasstilesprite;
     }
     else
     {
         selectedtile.sprite = lumbertilesprite;
     }
 }

And this is my generation function :

             Tilemap tilemap = GetComponent<Tilemap>();
             TilemapRenderer tileren = GetComponent<TilemapRenderer>();
             tileren.chunkSize = new Vector3Int(maxchunkx, maxchunky, 0);
 
             for (int x = 0; x < xSize; x++)
             {
 
                 for (int y = 0; y < ySize; y++)
                 {
                     RandomTile();
                     tilemap.SetTile(new Vector3Int(x, y, 0), selectedtile);          
                 }          
             }

I have set Sort order to Top Right on Tilemap Renderer but it does not help when moving the camera around the sprites order overlap back and forth between the 2 sprites. alt text

If I don`t mess around with the chunkSize Vector I get this every 32 positions (Default value for chunksSize Vector3Int is 32) alt text

Does anyone know how can I start fixing this rendering problems? Or offer a better solution for generating tiles/tilemaps of huge sizes? Any help will be appreciated

Update : I found a temporary solution, creating different tilemaps one for each sprite type layer and setting their order. While setting a tile on one tilemap the others get set to null on the same position, I`m pretty happy with the result.

capture.png (37.4 kB)
capture2.png (68.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

94 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can you add sprites to existing sprite sheet without breaking the tile pallet and in-game tiles 0 Answers

How can I modify the sprite of a particular Scriptable Tile in a Tilemap? 2 Answers

Unity 2D TileMap Rule Tile Carpet 1 Answer

TileMap.GetTile not working as expected 0 Answers

What is it TilemapRender.CameraBoundsJob? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges