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
I was looking for hours for a tutorial like this. This helped me SO MUCH. Thank you!
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!
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
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!!!
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!
I don't know why you only have this much sub. Your videos are awesome mate
Hey thanks! Hopefully the youtube algorithm will cut me some slack! :)
Thanks for the tutorial, helped a Brazilian who wants to implement this market more and more here, thanks again.
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:)
This is great! I will find a way to use this as part of a gore effect, just you wait and see.
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 =)
Thanks for the great tutorial!
3:05 "Ship it!" Ha ha ha!
i cant see the override button at all? any ideas? its at 3:18
Dude, thank you so much. This helped alot!
pretty awesome
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
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.
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
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)
hmm I'm facing the exact same problem
@@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
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.
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? 😢
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.
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.
same
Awesome, well explained.
Thanks JJ!
Good job, keep post the good stuff.
Thank you man
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?
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!
@@LostRelicGames I'd love to learn from it! :D You should do courses on Udemy if you haven't already!
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.
Khal Drogo is teaching me how to make clouds in unity ;))))
many many many thx!
For some reason its not detecting my endpoint properly keep deleting it at a weird point
I have an issue where only 1 cloud will spawn ever, any help?
Hello, can i use this to... say, make an asteroid belt on a topdown space shooter?
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! :)
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.
wow..very nice
Thanks Ahmed! Glad you like it.
Can i use this for a 3d game ?
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...
thanks bro
my pleasure man
thanks
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
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.
Fix it pretty quickly, but I'll leave it here if someone needs help.
in SpawnCloud
cloud.transform.parent = transform;
thanks bro