I’m trying to spawn a fixed number of ennemies, forming a wave of enemies. There will be five points from which they will be able to spawn. I’d like them to choose a random point from which to start, then spawn one after another until they are all there.
The delay will be fixed as well, about 3 or 4 secondes.
Do I need a script? Is there any tutorial available? Any help?
yes, you need a script, using unity without scripting is almoust impossible
for this you will need
an array of your spawn positions
a method to be invoked every 3 or 4 seconds
instantiating your enemy at one of your spawn positions
for the tutorials i would recommend how to programm for dummies to learn the basic concept about programming then you could use google and unity script reference to anything yo want to do with unity
Not bad, I’ll try this, that’s a good way to start.
As for programming, don’t worry, it might be okay. Thanks! I’ll give an update if I do anything good.
I’d like to know now how to link an array of spawnpositions into an instantiate…
I’ve tried this:
public class SpawnScript : MonoBehaviour
{
public int NumberEnemies;
public float SpawnTimer;
public float SpawnCountdown = 240.0f;
private Transform[] SpawnPoints;
private Transform[] Enemy;
private bool canSpawn = false;
void Start()
{
}
void SpawnEnemy()
{
// Mettre un index en paramètre de mes tableaux.
Instantiate(Enemy[0], SpawnPoints[0], Quaternion.identity);
NumberEnemies += 1;
SpawnTimer = 0.0f;
}
void Update ()
{
while(NumberEnemies != 7)
{
SpawnTimer = 0.0f;
SpawnTimer += Time.deltaTime;
if(SpawnTimer >= SpawnCountdown)
{
SpawnEnemy();
}
}
}
}
But it keeps on giving me this kind of error:
Assets/Scripts/SpawnScript.cs(24,17): error CS1502: The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)’ has some invalid arguments