First of all, I’m an absolute beginner. Following tutorials, I was able to make my object move and spawn.
My issue is that i dont know how to make the object only move after spawning. My goal is to make multiple object spawn randomly and move on their own from right to left.
Should the movement script be in the spawn script? As of now, movement script is added to the object and spawn script was added to an empty.
Edit: Finally got the spawn to be the way i want it. Only thing remaining the random spawn of 3 object
Spawn code I’m using:
public class Spawn : MonoBehaviour {
// Spawn variables
public GameObject spawnee;
public bool stopSpawning = false;
public float spawnTime;
public float spawnDelay;
// Use this for initialization
void Start () {
InvokeRepeating("spawnObject", spawnTime, spawnDelay);
}
// Spawn
public void spawnObject()
{
Instantiate(spawnee, transform.position, transform.rotation);
}
}