The game I’m working on has over 100 bullets at chaotic times and it gets really laggy. The enemies instantiate them when they spawn. Attached to each is a mover script, destroyOnContact script, rigidbody2D, circle collider 2D and sprite renderer.
Could you help me find out whats the main cause of this problem? I was assuming it was the rigidbody but I can’t find a way to move the bullets without it.
edit:
Here is the code, changed it up to get rid of rigidbody which helped but still a little bit laggy on my phone.
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour {
public float speed;
/*private Rigidbody2D rb;
void Start ()
{
rb = GetComponent<Rigidbody2D> ();
rb.AddForce(transform.right * speed);
}*/
public Vector3 Velocity;
void Update()
{
transform.Translate(Velocity * Time.deltaTime * speed);
}
}