init
This commit is contained in:
commit
bd5b1556ff
269 changed files with 6249829 additions and 0 deletions
24
Assets/Scripts/ObjectSpawner.cs
Normal file
24
Assets/Scripts/ObjectSpawner.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ObjectSpawner : MonoBehaviour{
|
||||
|
||||
public GameObject objectToSpawn;
|
||||
public Vector2 whereToSpawn;
|
||||
public float nextSpawn;
|
||||
public float spawnRate = 2f;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
if (Time.time > nextSpawn){
|
||||
nextSpawn = Time.time + spawnRate;
|
||||
Instantiate(objectToSpawn, whereToSpawn, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue