instantiate a prefab not working
I am making a call of duty zombies style game and am at the point where I am working out the spawnpoints. I have declared that I want the 'Zombie' prefab to spawn at the spawnpoints, but it is saying that "The name 'Zombie' does not exist in the current context". Please help, as I have been stuck on this for a couple of hours now. Here is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class GameManagement : MonoBehaviour { public int round = 1; int zombiesInRound = 10; int zombiesSpawnedInRound = 0; float zombieSpawnTimer = 0; public Transform[] zombieSpawnPoints;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void FixedUpdate () {
if(zombiesSpawnedInRound < zombiesInRound)
{
if(zombieSpawnTimer > 30)
{
SpawnZombie();
zombieSpawnTimer = 0;
}
else
{
zombieSpawnTimer++;
}
}
}
public void SpawnZombie()
{
Vector3 randomSpawnPoint = zombieSpawnPoints[Random.Range(0, zombieSpawnPoints.Length)].position;
Instantiate(Zombie ,randomSpawnPoint, Quaternion.identity);
zombiesSpawnedInRound++;
}
}
Your answer
Follow this Question
Related Questions
Create gameobject in other scene... 0 Answers
Prefabs not instantiating after build 0 Answers
References of a Prefab 1 Answer
prefab/instantiate problem. C#,Instanciate/Prefab problem. 0 Answers