I am making a 2d Infinite Runner game and was making a script for the spawn pads to generate. I have no idea how to fix the error.
The error:
Assets/Scripts/SpawnScript.cs(18,29): error CS0178: Invalid rank specifier: expected ,' or
]’
Also: Assets/Scripts/SpawnScript.cs(23,1): error CS8025: Parsing error
The script is:
using UnityEngine;
using System.Collections;
public class SpawnScript : MonoBehaviour {
public GameObject[] obj;
public float spawnMin = 1f;
public float spawnMax = 2f;
// Use this for initialization
void Start () {
Spawn ();
}
void Spawn ()
{
Instantiate(obj[Random.Range 0, obj.GetLength(0))], transform.position, Quaternion.identity);
Invoke ("Spawn", Random.Range (spawnMin, spawnMax));
}
}
}
If anyone could help, that would be awesome.
Thanks.