I am really a noob at this but I am trying to make it so that multiple instances of a Game Object spawn in a random position within a set radius. All I am able to do so far is to make it spawn in variations of a straight line
using UnityEngine;
using System.Collections;
public class WallGen : MonoBehaviour
{
public GameObject thePlatform;
public Transform GenerationPoint;
public float distancebetween;
private float platformWidth;
// Use this for initialization
void Start()
{
platformWidth = thePlatform.GetComponent<CircleCollider2D>().radius;
}
// Update is called once per frame
void Update()
{
if (transform.position.y < GenerationPoint.position.y)
{
transform.position = new Vector3(transform.position.x + platformWidth + distancebetween, transform.position.y, transform.position.z);
Instantiate(thePlatform, transform.position, transform.rotation);
}
}
}