- Home /
Preformance for 2D top down shooter
Hey guys. I'm new to unity and I could really use your help. Coming from flash (ActionScript3). I am trying to make top down shooter for mobile devices but performances of my prototype project are just terrible. I used this class for Object Pooling http://forum.unity3d.com/threads/76851-Simple-Reusable-Object-Pool-Help-limit-your-instantiations!
And I used this function for moving bullets:
void FixedUpdate ()
{
transform.Translate(new Vector3(directionX,directionY));
if(transform.position.y > 7)
{
ObjectPool.instance.PoolObject(gameObject);
transform.position = new Vector3(0,0);
}
}
And now I even removed all collision so I am sure that they do not impact performances.
So there are about 200-300 bullets at the time. I know its a lot but since there are no other effects I figured this should run smooth on my mobile device but actually its super laggy. Device I used is android Sony Xperia M that have 1gb ram and 1gh dual core processor. So its not even the slowest device I want to target.
Here is the screenshot of the project: http://prntscr.com/36ni91
Do you think it could be doing something wrong with my approach to this or is unity just not fast enough for 2D bullet hell game?
Thanks!
Not really sure what the problem could be without seeing more of the project, but unity should be able to handle this kind of game.
One issue I can think of is the way you are handling the bullets. You should probably attach a rigidbody component to them and move them using velocty. $$anonymous$$oving colliders without a rigidbody in unity causes a significant slow down.
Another is the ObjectPool, I'm not sure how that system is supposed to work or how well it performs on devices, so try removing it for now to see if that increases performance or not.