//a method to spawn the particles public void InstantiateParticleUnitys() { GameObject go = Instantiate(particleUnityPrefab); ParticleUnity b = go.GetComponent <ParticleUnity>(); b.transform.SetParent(particleAnchor); ParticleUnitys.Add(b); if (ParticleUnitys.Count < numParticles) { Invoke("InstantiateParticleUnitys", spawnDelay); } }
//a method to spawn the particles public void InstantiateParticleUnitys() { Vector3 SpawnPosition = particleAnchor.position + (_SpawnPoints[ParticleUnitys.Count] * SpawnRadius); GameObject go = Instantiate(particleUnityPrefab, SpawnPosition, Quaternion.identity); ParticleUnity b = go.GetComponent <ParticleUnity>(); //b.transform.SetParent(particleAnchor, true); b.MyParent = this.transform; b.TargetOffset = (_SpawnPoints[ParticleUnitys.Count] * SpawnRadius); ParticleUnitys.Add(b); if (ParticleUnitys.Count < numParticles) { Invoke("InstantiateParticleUnitys", spawnDelay); } }