Search code examples
unity-game-engineparticle-system

Particle system not moving


I'm making a small endless runner game about a fish swimming to school, and I want to include a particle system that replicates bubbles and indicates when it is speeding up. In order to make the fish swim through obstacles, he continually moves forward. However, when I try to move the particle generator forward through script, it doesn't work. Can someone tell me why?

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class motion : MonoBehaviour {

    public float motionSpeed = 1f;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        transform.Translate(motionSpeed / 10, 0, 0);
        motionSpeed += motionSpeed / 7200;
    }
}

Solution

  • I recommend attaching your particle system onto a separate gameobject which is a child of your fish that is swimming.