I am atempting to create a random spawn script. All was working fine, until I recieved this error code:
Assets/Scripts/Game/randomSpawn.cs(8,27): error CS1519: Unexpected symbol `=’ in class, struct, or interface member declaration
If anybody could help me out, I would appreciate it!
Code:
using UnityEngine;
using System.Collections;
public class randomSpawn : MonoBehaviour {
public float amountOfSpawnPoints = 2;
public spawnPoint = 0;
private static Vector3[] spawnPos = new Vector3[amountOfSpawnPoints];
// Use this for initialization
void Start () {
spawnPos[0] = Vector3(10,10,10);
spawnPos[1] = Vector3(20,20,20);
spawnPos[2] = Vector3(30,30,30);
SpawnObject();
}
// Update is called once per frame
void Update () {
}
public void SpawnObject() {
spawnPoint = Random.Range(0, amountOfSpawnPoints - 1);
Instantiate(spawnObj, spawnPos[spawnPoint], Quaternion.identity);
}
}