Last active
August 8, 2020 06:16
-
-
Save seferciogluecce/49a067cf6e3f1c7ffc6793cbc6ded277 to your computer and use it in GitHub Desktop.
Tutorial: https://youtu.be/OdE3Y11ud30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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