Stuttering in build

Hi

Whilst working on my first project I experienced stuttering in editor which I managed to improve however there is still significant stuttering in the motion of hazards when I build and export to an android device. There is also some, but lest frequent, stuttering in the main menu animations. I was wondering if anyone could suggest any fixes or help point out errors in my code that could lead to stuttering.

Many Thanks :slight_smile:

Here is the corouting I am using to spawn hazards, called in start.

    IEnumerator SpawnWalls()
    {
        yield return new WaitForSeconds(startWait);
        while (gameOver == false)
        {
            velocity += acceleration;

            Vector3 spawnPosition = new Vector3(spawnPoint.transform.position.x, 0.5f, spawnPoint.transform.position.z);
            Quaternion spawnRotation = Quaternion.identity;

            Instantiate(walls[Random.Range(0, walls.Length)], spawnPosition, spawnRotation);

            spawnWait = wallSpacing / velocity;
            yield return new WaitForSeconds(spawnWait);
        }
    }

Here is the script attached to the hazards to give them the desired velocity

public class mover : MonoBehaviour
{

public GameObject gameController;

private Rigidbody rb;

void Start ()
{
    gameController = GameObject.Find("GameController");
    rb = GetComponent<Rigidbody>();

    float spawnForce = (gameController.GetComponent<GameController>().velocity) * -50f;

    rb.velocity = new Vector3(0.0f, 0.0f, -gameController.GetComponent<GameController>().velocity);
    //rb.AddForce(0.0f, 0.0f, spawnForce);
}

void FixedUpdate ()
{
    if (transform.position.z < -10)
    {
        Destroy(gameObject);
    }
}

}

Try using the profiler or physics debugger when running the game