Unity 5 Tutorial: Avoid Double Spawn C#


How to avoid double spawns on random spawned gameobject positions. This is in addition to my Spawn Random Objects at Random Positions Tutorial, Link below!
▼▼▼ More Infos here: Check em out! ▼▼▼

➤ First Video:

➤ My Unity Assets:

Support me:
➤ Support me on Patreon:
➤ Want to use Patreon too?
➤ Donate with PayPal:

Social Media:
➤ Twitter:
➤ Facebook:

➤ My Website:
➤ My Website Hoster:



  1. How can you make things spawn at the same time.

    In this case how would you make those 2 coins spawn at the same time on different spawn points?

  2. This may be a bit advanced, but, do you have a tutorial where Player Object retains its inventory/points from scene 1, upon hitting a trigger in scene 1, spawns into scene 2, retaining its inventory/points from scene 1, but randomly and only once in one of these 8 spawn points without a constant spawn clone of the same player; and re-spawns in last scene it was in?

    All I ever see is hiding triggers in same scenes spawning at different locations, or dragging a prefab player into a second scene so when you hit said trigger you are using only the one you dragged in and obviously not retaining anything from the first. Thanks for any help on this.

  3. I want to appear in order
    According to possibleSpawns
    The first grasp Element0
    The second grasp Element1
    The third grasp Element2
    How do I change the code? thanks!!

  4. Hi , helpful tutorial thank you, however im using the same but destroying the coin when player collides. Problem is when it disappears it does not return? do i need to destroy the cloned coin instead ? thanks

  5. thanks ~!it's very helpful. and some question. could you some more let me know how fix that not appear coins random but procedurally ? really good job

  6. Hey XOctoManX, I followed this tutorial and got my level to spawn an environment of randomly placed rocks like I wanted, essentially every time I start the game in the editor as run time, it creates a randomly generated terrain. Recently, however, I tried to copy and paste the code that I created by following your tutorials into another project, and it seemed to work at first. However, this time, I noticed that every time I play the game in run time, it doesn't randomly create a new environment, but rather recreates the randomly created environment that was spawned the first time I played it. The script is not giving me any errors that I can identify, and I have deleted the meta data and restarted Unity a bunch of times, but it seems to cycle between two or three specific environments that were randomly created only, instead of randomly creating it every-time. I don't know what is happening, it works fine on the old project, but not for the new one. Would you have any advice for this?


  7. hello sir…. i tried your code but what i wanted to make is instead of destroying object with time iwant it ontrigger but what happens is when the object collide with my player the object is being destroyed and it doesnt respawn anymore… hope you help me with my problem..


Please enter your comment!
Please enter your name here