- Home /
Particle effect before spawn enemy
Hello, i want to made a dual stick shooter game.
what I would try to do is that before the spawn was created a small particle. But I have no idea how to do.
This is the script that i use for the enemy spawn
public class enemySpawner : MonoBehaviour { public GameObject enemyType; public float spawnRadius = 10.0f; public float spawnDelay = 0.7f;
void Start ()
{
Invoke ("SpawnEnemy",spawnDelay);
}
void SpawnEnemy ()
{
//Vector3 spawnPosition = transform.position + ((Vector3)Random.insideUnitCircle).normalized * spawnRadius;
Vector3 spawnPosition = new Vector3 (Random.Range (-17,18),Random.Range (-10,-8),0);
Instantiate (enemyType, spawnPosition, enemyType.transform.rotation);
Invoke ("SpawnEnemy", spawnDelay);
}
void OnDrawGizmosSelected ()
{
Gizmos.DrawWireSphere (transform.position, spawnRadius);
}
}
thanks for the help!!
Answer by Sisso · May 19, 2014 at 03:14 PM
Create a prefab with your effect
https://docs.unity3d.com/Documentation/Manual/Prefabs.html
Instantiate it
http://docs.unity3d.com/Documentation/ScriptReference/Object.Instantiate.html
Then wait some time and create the enemy
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.Invoke.html
Finally remove the effect
http://docs.unity3d.com/Documentation/ScriptReference/Object.Destroy.html
Your answer
Follow this Question
Related Questions
enemy spawning when dead 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How would I go about enemy spawning? (C#) 1 Answer
Having camera attack upon spawning player? 1 Answer
Simple enemy kill count 1 Answer