- Home /
iTween vs GoKit
Hello. I have say 10 instances of a prefab consisting of a box plane (2 triangles). The material points to a texture atlas png file. I have them fading in using iTween's colorto function. The problem with this is that the color tween will create an instance of the material used for each object instead of affecting the sharedMaterial. It doesn't look like there is a solution in iTween. As I looked online for solutions, I came across GoKit. Would GoKit allow me to do this?
Answer by robertbu · Jan 12, 2013 at 06:40 AM
I don't know about GoKit specifically, but I believe the problem you are facing is inherent in Unity. I've playing with some code that has the user generating up to 1000 of the same game object. If the color/alpha stays the same, then the number of draw calls is just a handful (they are batched). But if I change the color/alpha at all, it appears that each object get's its own cloned copy of the shared material, and Unity will no longer batch the draw calls.
But performance is not as bad as I expected. For 1000 objects each with around 35 triangles, I'm getting 1000+ draw calls and 12 - 14 FPS on the iPad 3. Not great but still usable. Which means that you may be trying to optimize too soon. In addition when I increased the complexity of the game objects to 350 triangles, the frame rate dropped to around 8-10 FPS...sluggish but not what I would have expected from a 10x increase in triangles.
I did run across one possible solution, but I've not run any tests ont it yet. It appears that I can combine meshes and use a materials array and drop the draw calls substantially.
No, but I did run a couple of tests with something Vectrosity...a line drawing package that builds a combined mesh. Using an array of 9000 lines, each assigned a random color, iPad 3 performance was 28 - 30 fps (though it varies by shader). A similar test with simple geometry in my code above using separate meshes had 17 fps for only 1000 meshes. So Vectrosity had twice the performance with 9x number of lines and triangles.
Your answer
![](https://koobas.hobune.stream/wayback/20220613090124im_/https://answers.unity.com/themes/thub/images/avi.jpg)