Skip to content

Instantly share code, notes, and snippets.

@seferciogluecce
Last active August 8, 2020 06:16
Show Gist options
  • Save seferciogluecce/49a067cf6e3f1c7ffc6793cbc6ded277 to your computer and use it in GitHub Desktop.
Save seferciogluecce/49a067cf6e3f1c7ffc6793cbc6ded277 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Spawner : MonoBehaviour
{
private Vector3 SpawnPos;
public GameObject spawnObject;
private float newSpawnDuration = 1f;
#region Singleton
public static Spawner Instance;
private void Awake()
{
Instance = this;
}
#endregion
private void Start()
{
SpawnPos = transform.position;
}
void SpawnNewObject()
{
Instantiate(spawnObject, SpawnPos, Quaternion.identity);
}
public void NewSpawnRequest()
{
Invoke("SpawnNewObject", newSpawnDuration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment