Cloud Spawning System in Unity (Instantiate Random floating prefabs) | Game dev Tutorial

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • In this game dev tutorial I show how to create a dynamic cloud generation system in unity, which spawns and instantiates random cloud prefabs from our library (with random scales, position and speed)
    Make car games easy with this Car Game Unity Asset:
    u3d.as/1HFX
    Join the discord community
    / discord
    Subscribe here for more cool tutes
    bit.ly/2MpZ1ao
    Support me on Patreon:
    / lostrelicgames
    My game Blood And Mead on Steam:
    www.bloodandmea...
    Project Files from this video:
    drive.google.c...
    #gamedev #unity3d #programming

КОМЕНТАРІ • 54

  • @MichelleMassaMCM
    @MichelleMassaMCM Рік тому +2

    I was looking for hours for a tutorial like this. This helped me SO MUCH. Thank you!

  • @thewiredspider9660
    @thewiredspider9660 4 роки тому +1

    I love this video! I put a bit of random color and opacity into mine to give it even more variance. The clouds make the game feel so much more alive. Thank you!

  • @LostRelicGames
    @LostRelicGames  5 років тому +4

    I hope you enjoy this tutorial! I appreciate every single like and comment, It really helps to keep this channel going and spread the knowledge. Don't forget to swing by the discord if you want to chat! :) discord.gg/yeTuU53

  • @王殊-p9f
    @王殊-p9f 9 місяців тому

    Really good video!!! During I am watching, I was thinking about how about add some random and then the video shown add random things into the functions!!! That makes a lot different and more interesting!!!
    Really Great!!!

  • @soundhunter4349
    @soundhunter4349 3 роки тому

    Thank you very much! I have started my first project in Unity and this is the first thing I decided to do. I spent about 3 days watching this tutorial and learning every word used here to realize everything properly. Finally I did it! It was really interesting, I got to know about lots of things, you helped me a lot!

  • @hydrahung7156
    @hydrahung7156 5 років тому

    I don't know why you only have this much sub. Your videos are awesome mate

    • @LostRelicGames
      @LostRelicGames  5 років тому +2

      Hey thanks! Hopefully the youtube algorithm will cut me some slack! :)

  • @VedoHT
    @VedoHT 3 роки тому

    Thanks for the tutorial, helped a Brazilian who wants to implement this market more and more here, thanks again.

  • @games2play502
    @games2play502 4 роки тому +3

    Great tutorial this is a much better way than my way so ill use your code for my game also i have just subscribed to your channel, keep up the good work:)

  • @synchaoz
    @synchaoz 4 роки тому +3

    This is great! I will find a way to use this as part of a gore effect, just you wait and see.

  • @brunosoares6717
    @brunosoares6717 4 роки тому +2

    for those who want to make the generator follow the player here is what I did: I attach the cloud generator to my Virtualcamera, but it can be anything that follows the player without flip, then I just chance the StartPos to update or fixedupdate instead of Start and it's done =)

  • @elwin1283
    @elwin1283 4 роки тому +1

    Thanks for the great tutorial!

  • @coreysonofander
    @coreysonofander 4 роки тому +1

    3:05 "Ship it!" Ha ha ha!

  • @jackyb2837
    @jackyb2837 4 роки тому

    i cant see the override button at all? any ideas? its at 3:18

  • @mitchellmacpherson4052
    @mitchellmacpherson4052 2 роки тому

    Dude, thank you so much. This helped alot!

  • @MegaJHONDY
    @MegaJHONDY 2 роки тому +1

    pretty awesome

  • @yvesgingras1475
    @yvesgingras1475 3 роки тому +1

    Quick question: Would it not be better to make a particule system instead? And combining the different textures of cloud into one sprite?
    I dont want to bash or anything this is a leggit question, I wonder wich one would bring the bet result for the lowest performance cost

  • @TwistdRabbit
    @TwistdRabbit 4 роки тому

    Hey, having some issues with this one, from the minute i opened the project i have an error in unity "Assets\CloudGeneratorScript.cs(42,28): error CS0246: The type or namespace name 'CloudScript' could not be found (are you missing a using directive or an assembly reference?)
    This was replaced after i added the CloudScript file from the video with "Assets\CloudGeneratorScript.cs(42,43): error CS1061: 'CloudScript' does not contain a definition for 'StarFloating' and no accessible extension method 'StarFloating' accepting a first argument of type 'CloudScript' could be found (are you missing a using directive or an assembly reference?)
    Moving back to unity after entering the cloudscript.cs code i cant play the scene
    I assume i will enter the information to fix this error as the video continues but i have managed to get as far as deleting the extra 3 clouds and now cant copy the component, the option is greyed out.
    Any help would be great.

  • @CallTheFknSparky
    @CallTheFknSparky 3 роки тому

    Rather than putting another invoke in the function use InvokeRepeating heres a little example
    InvokeRepeating("SpawnCloud", 1f, spawninterval);
    ^
    That is when it starts so it starts calling after 1 second then it repeats every spawn interval

  • @oliverj2635
    @oliverj2635 3 роки тому +2

    I'm doing everything you say but it still doesn't work :(
    NullReferenceException: Object reference not set to an instance of an object
    CloudGeneratorScript.SpawnCloud (UnityEngine.Vector3 startPos) (at Assets/Scripts/CloudGeneratorScript.cs:41)
    CloudGeneratorScript.Prewarm () (at Assets/Scripts/CloudGeneratorScript.cs:59)
    CloudGeneratorScript.Start () (at Assets/Scripts/CloudGeneratorScript.cs:22)

    • @fabsze7857
      @fabsze7857 2 роки тому

      hmm I'm facing the exact same problem

    • @kayaltamira
      @kayaltamira 2 роки тому

      @@fabsze7857 heya... did you ever got this fixed? I started to do this now and I have the same problem. I did everything he said to the T and I even tried to fix this problem with .find code, changing the name of my script, then re-linking it and nothing. Is driving me mad. I've done the tutorial twice, getting the same Null results. Any help would be much appreciated x

  • @MertAliBarlas
    @MertAliBarlas 4 роки тому +1

    it's working but, when I attach this CloudGenerator prefab to my camera its disappearing and the positions of each cloud prefab is not relative to camera. How can we fix this ? Thanks.

  • @jannahilario314
    @jannahilario314 Рік тому

    Hii, can you help me? I'm getting this error in endPoint saying that it does not contain the definition for transform. What to do? 😢

  • @finfondler998
    @finfondler998 3 роки тому

    Is it possible to create a randomly generating scene and have it running as a webpage? Very noobish question I'm sorry but I just had an idea from this video.

  • @mohamedmusamustafa3324
    @mohamedmusamustafa3324 4 роки тому +4

    I have a problem where if my camera goes into the right direction, the clouds stop appearing and if i go fast enough they wont be there.

  • @jaskarnjass8548
    @jaskarnjass8548 5 років тому

    Awesome, well explained.

  • @fahdali5330
    @fahdali5330 5 років тому

    Good job, keep post the good stuff.

  • @MistaWind
    @MistaWind 5 років тому +2

    Awesome tutorial! :D
    Have you ever tried to make a mini replica Castle Crashers games? Not a full game of course but, like a one map 2.5D scroller with attacking and up down left right movement?

    • @LostRelicGames
      @LostRelicGames  5 років тому +1

      hey thanks! I actually love the side scrolling brawler genre. I did some hobby things with it years ago, but i' love to revisit it!

    • @MistaWind
      @MistaWind 5 років тому

      @@LostRelicGames I'd love to learn from it! :D You should do courses on Udemy if you haven't already!

  • @fabian6739
    @fabian6739 4 роки тому +1

    Great tutorial! Just one question, how would I make the generator spawn clouds in a group? I want the clouds to spawn inside of a clouds gameobject so its visible on my canvas.

  • @omaewa5073
    @omaewa5073 4 роки тому

    Khal Drogo is teaching me how to make clouds in unity ;))))

  • @Offline1988
    @Offline1988 3 роки тому

    many many many thx!

  • @model2k204
    @model2k204 2 роки тому

    For some reason its not detecting my endpoint properly keep deleting it at a weird point

  • @Kingizeekiel
    @Kingizeekiel 4 роки тому

    I have an issue where only 1 cloud will spawn ever, any help?

  • @flyssa8211
    @flyssa8211 5 років тому +1

    Hello, can i use this to... say, make an asteroid belt on a topdown space shooter?

    • @LostRelicGames
      @LostRelicGames  5 років тому +2

      Absolutely, for top down you h would simply change the movement direction, should be one line of code. If you run into any issue swing by the discord and I'll help you out! :)

  • @MistyWings
    @MistyWings Рік тому

    Hey! Just wondering if anyone was having trouble with some of the prewarmed clouds not moving? It's not all of them, but it's very noticeable.

  • @verofero
    @verofero 5 років тому

    wow..very nice

  • @Thebaker3
    @Thebaker3 4 роки тому

    Can i use this for a 3d game ?

  • @fatmarajab114
    @fatmarajab114 4 роки тому +4

    Really helpful tutorial... I have most of it working but I'm coming across 2 problems..
    1. My clouds are still all spawning on the same y value, even though I've tried varying the y displacement by about 100
    2. When running the prewarm, all the spawned clouds are at the cloud generator point and not spawning across the scene
    I have a fairly large 2d scene which could be the cause of these issues, but I would really appreciate an expert opinion...

  • @jakobpriebe2393
    @jakobpriebe2393 4 роки тому

    thanks bro

  • @ChristianOrthodox
    @ChristianOrthodox 3 роки тому

    thanks

  • @StigDesign
    @StigDesign 5 років тому

    Great video as allways :D btw i can help you with Rune Text in that Viking game(Am from Norway so am a Viking hehe) :)
    Loved the 10/10 ign Refrence XD althoe its usually only COD that gets 10/10 ;D

  • @Saumler
    @Saumler 3 роки тому

    Thank you very much I worked great, but as much as I try I can not make them born from a point as a child, for example as children cloud generator.

    • @Saumler
      @Saumler 3 роки тому

      Fix it pretty quickly, but I'll leave it here if someone needs help.
      in SpawnCloud
      cloud.transform.parent = transform;

  • @kajaplayer1866
    @kajaplayer1866 Рік тому

    thanks bro