using UnityEngine;
using System.Collections;
public class CreateRandomEnemies : MonoBehaviour
public GameObject enemyPrefab;
public float numEnemies;
public float xMin = 19F;
public float xMax = 85F;
public float yMin = 3.5F;
public float yMax = -4.5F;
void Start ()
GameObject newParent = GameObject.Find("1 - Background Elements");
for (int i = 0; i < numEnemies; i++)
{
Vector3 newPos = new Vector3(Random.Range(xMin, xMax), Random.Range(yMin, yMax), 0);
GameObject octo = Instantiate (enemyPrefab, newPos, Quaternion.identity) as GameObject;
octo.transform.parent = newParent.transform;
}
}
}
Following this tutorial
http://gamedevnation.com/game-development/extra-pixelnest-video-random-enemies/
I am getting the following errors
“Assets/Scripts/CreateRandomEnemies.cs(7,22): error CS1031: Type expected”
Assets/Scripts/CreateRandomEnemies.cs(19,55): error CS1519: Unexpected symbol =' in class, struct, or interface member declaration Assets/Scripts/CreateRandomEnemies.cs(19,76): error CS1519: Unexpected symbol
;’ in class, struct, or interface member declaration
Assets/Scripts/CreateRandomEnemies.cs(21,19): error CS8025: Parsing error
It has been copied from the site (with the html removed, name of script changed from CreateRandomPoulpi.)
And copied from the video… He shows it working. I have read backwards and 10 times to make sure there are no discrepancies. I even restarted unity just incase it was having a hissy fit. Still I get these errors. Something seems strange also since its not the first time I have encountered this error in a different tutorial involving “GameObject”.
Have a heart, help a noob. I would like to have this script working for future projects.
Thanks