So i have a script, and i am attempting to do something way over my head… my solution (clearly, as you will see) didn’t work.
I have a spawn point that spawns fine, but will only spawn in the same place (wherever i place the empty spawn point game object) What i want it to do is spawn at random locations around that spawn point on a finite ground. Here is the code i am using so far,
function SpawnPickup()
{
// retrieve the position and rotation of the pickup's spawn point
var spawnedPickupPosition transform.position.z = Random.Range (-11.7,11.8);
transform.position.x = Random.Range(11.5,-11.9);
var spawnedPickupRotation:Quaternion = spawnPoint.transform.rotation;
// instantiate (create) the pickup prefab with the above position and rotation
var spawnedPickup:GameObject = Instantiate(pickupPrefab, spawnedPickupPosition, spawnedPickupRotation);
// set the spawned pickup as a child of the 'PickupSpawnPoints' gameobject that this script is a Component of
spawnedPickup.transform.parent = spawnPoint.transform;
}
The problem is on line four and five, like i said this is way over my head. Thank you guys!