2D Toolkit Forum

2D Toolkit => Support => Topic started by: singh029 on April 15, 2014, 05:10:10 pm

Title: 2D toolkit incrasing performance
Post by: singh029 on April 15, 2014, 05:10:10 pm
Hey! So i wanted to create multiple levels for my 2d platformer. The only thing i was afraid of was the performance on mobile devices.

Is there a way to turn off (setactive = false) the tiles in a tilemap when off screen?
i.e. Pooling
Is there a way to access each tile programmatically or would that cost too much?

Thank you!
Title: Re: 2D toolkit incrasing performance
Post by: unikronsoftware on April 16, 2014, 10:19:17 am
It shouldn't be necessary. tk2d splits up tile map into chunks, and unity will cull those chunks when out of screen. It doesn't deal with 1000s of game objects at a time, but merges 1024 tiles into 1 chunk by default.
Title: Re: 2D toolkit incrasing performance
Post by: singh029 on April 17, 2014, 10:18:03 pm
Sweet! what if i set a prefab inside one of the tiles in the Data tab of the tilemap? do those also get culled?
Title: Re: 2D toolkit incrasing performance
Post by: unikronsoftware on April 18, 2014, 05:10:41 am
They will get culled, but those should probably be turned off and on - check the tk2dTileMapDemoCoin code, it uses OnBecameInvisible, OnBecameVisible to turn off the animator when out of view