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 Roamer · May 31, 2019 at 04:32 PM · performancetilemapprofilerperformance optimizationtiles

Question regarding TileMap Performance

I'm working on a large scale procedural world, and am currently using Unity's TileMap system to render it. The world is currently (500 x 16) x (500 x 16) tiles large, but I render it in 16x16 tile chunks, with maybe 4-6 chunks on screen at a given time. I only regenerate chunks that are not already rendered, and I only check if the camera moves.

There are a few things popping up in the editor I can not find information about. One of them is during ChunkGeneration, namely the Tilemap.HasSyncTileCallback() function. This is generating a large amount of garbage, and I have no idea what it does, or if I can disable it.

The other function call is also concerning since it seems to increase the more I render tiles. This is named in the profiler as TilemapRenderer.CameraBoundsCheck -> WaitForJobGroupID -> TilemapRenderer.CameraBoundsJob. Note that I am not changing the camera bounds or anything.

I cannot find any guidelines concerning Tilemap do's and don'ts in regards to performance. Should I be changing the origin of the tilemap whenever I render? I assume rendering tiles far from the origin costs more performance, but there is no documentation to be found.

Any help is appreciated.

Update 1:

The abovementioned CameraBoundsCheck bottleneck has to do with how large TileMap.Size is, setting it to a very large size will make the function take an insane amount of time.

So the ideal solution would be to set the TileMap's Origin to the bottom left tile of the chunk I am rendering, and the size to the size of all rendered chunks combined.

TileMap.Size and TileMap.Origin minimum and maximum values seem to be changed whenever a new tile is placed outside of the current Origin and Size.

However, settings these values manually seems to have very strange effects on rendering. It seems to stop rendering at certain boundaries, and for some odd reason reselecting the Camera in the hierarchy "refreshes" this area, as can be seen here: https://streamable.com/c00kg

Update 2:

I still have no idea what is happening. If I call TileMap.CompressBounds() Unity resizes the TileMap to the Origin and Size I am manually setting it to. Using CompressBounds() instead of simply settings Size and Origin works for some reason, so I assume Unity is calling something behind the scenes to update some part of the TilemapRenderer. Ideally manually setting this should be possible somehow since CompressBounds() is most likely slower than simply calculating bounds with the knowledge of how big each chunk is.

Maybe someone has successfully manually updated Tilemap bounds before? I feel like it's possible since why do Size and Origin have a setter then, instead of just a getter? Also I tried calling TileMap.ResizeBounds() since that sounds like what I want, but it doesn't have the desired result. (Nothing at all seems to happen...)

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

125 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 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

Profiler shows Gfx.WaitforPercent Cause more time what this (Gfx.waitforpercent ) is ? 0 Answers

How to debug unity editor performance? 1 Answer

Lowered general performance with Threads 1 Answer

Unity Tile Array vs Int Array Performance 0 Answers

BehaviourUpdate taking unreasonable amounts of resources in the profiler 1 Answer


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