using System.Collections; using System.Collections.Generic; using UnityEngine; public class GeneratorRandom2D : MonoBehaviour { public GameObject monster; public int height = 5; public int width = 7; Vector3 position; void Start() { InvokeRepeating("Generate", 0f, 0.5f); } void Generate() { position = transform.position; position += new Vector3(Random.Range(-width, width), Random.Range(-height, height), 0); Instantiate(monster, position, Quaternion.identity); } }