• 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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Reading Profiler Results 1 Answer

How to display a tile map efficiently? 1 Answer

Figuring out which specific objects are slow to render? 0 Answers

Unity 2019.3 LWRP strange Performance Issue on android 0 Answers

performance issue on android devices unity 2018.1.1f1 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges