Hey, so I’m INSANELY new to coding and C#… I’m working on a project, and I’m trying to make an object spawner. When I hit play on my game though, it only makes that object once. I used this same code on a different object and it works fine (this is also not my code, and probably more complicated than what I would need for this).
Here’s the code I’m using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Light : MonoBehaviour
{
public GameObject[ ] ob;
public Transform campos;
// Start is called before the first frame update
void Start()
{
LightMaker();
}
// Update is called once per frame
void Update()
{
}
void LightMaker()
{
GameObject clone= (GameObject) Instantiate (ob[Random.Range(0,ob.Length)], transform.position, Quaternion.identity);
clone.name=“Quad(1)”;
float xx=Random.Range(1,5);
Invoke(“LightMaker”,xx);
}
}