Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: DaiDesign on March 25, 2013, 05:55:49 AM

Title: High Draw Calls
Post by: DaiDesign on March 25, 2013, 05:55:49 AM
Hi There,

I'm very new to Unity and Playmaker, so please be gentle with your answer/s.

Is there a way to reduce the draw calls when a texture is offset (using texture atlas).

Here's what I'm doing (or trying to do :)

I followed the video tutorial no 6 - Platform Color Change as it was similar to what I was trying to achieve. When a character walks on a floating platform, made up of tiles, he will have to light up certain tiles to try and solve a puzzle that will then open a door on the other side. The tiles will alternate on/off as he walks on them with the option to turn them on/off as often as he likes (like the video tutorial) until he solves the puzzle.

Problem

Every time he triggers a tile by moving over the tile, which offsets the texture (using the same setup as in the video, except I'm using textures) the draw calls keep going up as they are being instanced. I've tried using CombineChildren.cs and OptimizedCombineChildren.cs but that of course does not work.

Is there a way to do the above but keep the draw calls from going up, as this is going to be a mobile game.

P.S. - I tried a script on this website but as I'm not a coder, I had no clue how to fix the problems in the script. Not sure if it would work anyway.

(remove spaces)
unitygameproject . blogspot . co . uk/2010/03/mesh-combine-at-runtime-unity . html
Title: Re: High Draw Calls
Post by: jeanfabre on March 25, 2013, 06:56:11 AM
Hi,

 What kind of tools are you using to show these textures? if you don't use any, then you should. Something like nGUi, 2dToolkit, etc etc, they will do that calls reducing automatically for you, and you will gain a lot of power.

 if you are building a tile game, then also have a look at existing frameworks on the asset store, they will also give you awesome power and efficiency both in terms of design and performances.

bye,

 Jean
Title: Re: High Draw Calls
Post by: DaiDesign on March 25, 2013, 08:00:20 AM
Hi again

Thanks for the quick reply.

I'm not using any tools, but do plan on getting NGUI at a later stage.

So will the above mentioned tools work for a 3d level as I thought they where only for 2d style games.
The game has a Third person camera view. Each tile, actually a cube, have the same texture on all sides, all uv'ed in 3ds max. All I'm doing is off setting the texture by 0.25 (256 x 256 texture with a couple of 64 x 64 individual textures in the atlas). But every copy of the block is creating a new draw call due to that texture off set when triggered.

The Video tutorial no 9 - Platform Puzzle Chest Opening Game would have the same problem with Draw Calls once triggered.


UPDATE

Not quite a solution but a workaround. Comes under the heading of - It'll do for now :)

I changed the FSM to change the visibility of 2 Cubes (both occupy the same world space), one is on and the other is off, then on trigger they swap over. Draws calls stay low (1 Draw call Total for all cubes, 25 tested). Verts change from 720 up to 1.4k So I'll try and find a solution for that part.
Title: Re: High Draw Calls
Post by: jeanfabre on March 26, 2013, 01:15:31 AM
Hi,

 There are some 3d level editors on the asset stores too.

 Now, what is your general stats on your games. Maybe you are over doing this optimization? for example: targeting iPad 2 +, I have here a project open, the stats are:

267 drawCalls with 205 saved by batching
58K tries, 50K verts
45 MB of used textures.

and these numbers goes up as you progress in the games or depending on how players or ui is shown.

 Generally, it's better to get your game working, and then look for way to optimize, else you may get frustrated even before reaching a playable game. How far are you in your game?

bye,

 Jean