Hello Guest

Author Topic: how to optimize long TileMap?  (Read 4627 times)

stevexu

  • Newbie
  • *
  • Posts: 29
    • View Profile
how to optimize long TileMap?
« on: October 16, 2013, 03:52:44 pm »
I  have a long tilemap, in which  I set a prefab for the  tile  "brick", so there are so many bricks in the sense, the brick play animator by using tk2dSpriteAnimator, but the performance is poor on some android  mobile device, So how can i optimize it?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: how to optimize long TileMap?
« Reply #1 on: October 16, 2013, 04:10:51 pm »
If you have many animated sprites spawned using prefabs, consider turning off the animator when its not visible. Check tk2dTileMapDemoCoin for an example. If that isnt enough, you'll have to do other things to optimize this, for example turning off tilemap chunks when not visible.

stevexu

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: how to optimize long TileMap?
« Reply #2 on: October 16, 2013, 04:26:17 pm »
Thanks ! But How to  turning off tilemap chunks when not visible? some code?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: how to optimize long TileMap?
« Reply #3 on: October 16, 2013, 04:44:24 pm »
I wouldn't go that far unless absolutely necessary.
tilemap.Layers
  • .GetChunk(x, y) will return the chunk

SpriteChunk.gameObject = the game object for the chunk, which you can SetActive to turn on and off.