Last active
November 14, 2019 13:23
-
-
Save TheCuttlefish/6eeb0877ff82104e66133dfa5544a537 to your computer and use it in GitHub Desktop.
Basic Spawn
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Spawner : MonoBehaviour { | |
int spawnCounter = 0; | |
void Update () { | |
spawnCounter+= 1; | |
if(spawnCounter > 100){ | |
//spawn your object here!! | |
spawnCounter = 0; | |
} | |
} | |
} |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SpawnerRandom : MonoBehaviour { | |
int spawnCounter = 0; | |
void Update () { | |
spawnCounter += 1; | |
if (spawnCounter > 100) { | |
//spawn your object here!! | |
spawnCounter = Random.Range (-10, 10); | |
} | |
} | |
} |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SpawnerRandom2 : MonoBehaviour { | |
int spawnCounter = 0; | |
void Update () { | |
RandomSpawner (); | |
} | |
void RandomSpawner () { | |
spawnCounter += 1; | |
if (spawnCounter > 100) { | |
//spawn your object here!! | |
spawnCounter = Random.Range (-10, 10); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment