Hi everyone!
I know that this issue have been discussed many times, but still I can not solve it.
There are a lot of simple 3D objects (cylinders) on my screen and in the sceene (about 30 at the time). All of them have “Mobile/Diffuse” shader, but at the same time I need to scale each one of them, which, as I suppose, causes FPS yo be higher than recomended value. Especially on android devices.
Any advices how to optimize the scene?
As you can see on the picture above, there are a lot of red lines spawned which are all in fact 3d cylinders with “mobile/diffuse” material attached. I’ts important to mention that there is a spawner component in a program working perfectly, so all the objects you see on the screen are only objects enabled and active and rendering in a present moment.
On the picture above you can see one cylinder’s object inspector. As you can see it does not have collider.
Script on update of each cylinder is a little bit tricky:
void Update () { if (!(gameObject1PositionBefore.Equals(gameObject1.position) && gameObject2PositionBefore.Equals(gameObject2.position))) { selfTransform.position = (gameObject1.position + gameObject2.position) * 0.5f; selfTransform.localScale = new Vector3(startScale.x, (gameObject1.position - gameObject2.position).magnitude / width, startScale.z); selfTransform.LookAt(gameObject1); selfTransform.Rotate(new Vector3(90,0,0)); gameObject1PositionBefore = gameObject1.position; gameObject2PositionBefore = gameObject2.position; if (!isRendered) { SetVisible(true); } } }
here it’s imporatant to mention that gameObject1 and gameObject2 are just the dull objects which stands at the both ends of the stick determing it’s position and scale