- Home /
Spaceshooter enemy spawning problem
Hi Unity answers. I am trying to make a space shooter but i cant get the enmy to spawn. i have checked my script through so many times but i can not find the problem. here is my script.
using UnityEngine; using System.Collections;
public class GameController : MonoBehaviour
{
public GameObject hazard; public Vector3 spawnValues;
void start ()
{
SpawnWaves ();
}
void SpawnWaves ()
{
Vector3 spawnPosition = new Vector3(Random.Range(-spawnValues.x,spawnValues.x), spawnValues.y, spawnValues.z);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (hazard, spawnPosition, spawnRotation);
}
}
How do you know it's not spawning? I mean are you looking in the Editor and seeing that indeed no enemy ship has spawned, or are you just playing the game and seeing that it is not visible? What values of spawnValues.x are you using? Did you assign hazard in the inspector? Do you get any printouts from the console log?
Answer by Dave-Hampson · Mar 24, 2014 at 09:17 PM
The Start() function is case sensitive: it looks like in your code it uses a lower case 's' so it will never be executed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613140828im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Tower Defence style spawning(enemies) 1 Answer
Destroy and Spawn an Enemy 1 Answer
Spawning enemy mobs .......... Instantiate woe ? 2 Answers
Error: Instantiated Enemies don't get hit 2 Answers
Enemies Spawn, Then Follow Waypoints 1 Answer