Spawning Objects in Unity [Using Instantiate]

  Рет қаралды 240,324

Press Start

Press Start

Күн бұрын

Пікірлер: 380
@pressstart6864
@pressstart6864 5 жыл бұрын
Copy & paste source code: pressstart.vip/tutorials/2018/09/25/58/spawning-obstacles.html
@myworld7667
@myworld7667 4 жыл бұрын
i need some help, can you help me... i copy the code but i dont know how change rocks movement from below to up.... i try the code but when i play the scene the rocks its not found but it is work....
@myworld7667
@myworld7667 4 жыл бұрын
i dont know where is my fault
@moncicis
@moncicis 4 жыл бұрын
that code used in perspective camera...not orthographic
@leostudios5700
@leostudios5700 4 жыл бұрын
The code is not workkng for me and i dont know why it says i have have no where to put the asteroid prefab or the respawn time it wont pop up kn the knspector
@pegassus-oj1zj
@pegassus-oj1zj 3 жыл бұрын
@@myworld7667 did you change the axes
@Tanicorn
@Tanicorn 4 жыл бұрын
"Quarantines can look scary but they're actually quite simple" The World:"Sorry what I don't understand?"
@soaringsquid0.129
@soaringsquid0.129 4 жыл бұрын
TaniCorn I think you mean coroutines
@thenukdevendra1902
@thenukdevendra1902 4 жыл бұрын
Look where we are now and you might understand lol
@zombiepigmandude7759
@zombiepigmandude7759 4 жыл бұрын
@@soaringsquid0.129 r/woosh
@cryo7180
@cryo7180 4 жыл бұрын
YES THIS, i was like.... is it supposed to be Quarantine... or Co - ROUTINE?!?!?!
@Gir_0
@Gir_0 4 жыл бұрын
IKR
@inigoarribillaga1183
@inigoarribillaga1183 5 жыл бұрын
I see you haven't uploaded in a while. I wanted to let you know that all your videos have been very helpful to me and that I would like to see more content from you, if you can of course. Thanks for your service.
@pressstart6864
@pressstart6864 5 жыл бұрын
Thanks bud! Don't worry I will be posting videos again soon. I needed to take some time off to build out a website and do some rebranding, and things like that. Hopefully by the end of this month I'll have a consistent posting schedule. Cheers!
@JakeSimmer
@JakeSimmer Жыл бұрын
Hi, I just found this channel and it's very clear to follow along, but also I've been watching alot of vids these days because of the steep learning curve... It starts to make a little more sence now...
@mrlloydval2887
@mrlloydval2887 5 жыл бұрын
i'm very new to unity, c#, making games and stuff. i don't have a deep understanding of most of this, but i noticed that the code you used here 4:29 "if(transform.position.x < screenBounds.x)", the < screenBounds.x part only seems to work when the camera projection is set to perspective. i've been using the orthographic camera projection because i was told that it's better for 2d games. if not would you mind explaining the difference? also do you plan on making a tutorial like this for an orthographic camera projection?
@pressstart6864
@pressstart6864 5 жыл бұрын
The simple answer is perspective camera inverts the screenBounds value. So if you’re dealing with orthographic either multiply it by -1 or flip the if statements. Hope that helps
@mrlloydval2887
@mrlloydval2887 5 жыл бұрын
@@pressstart6864 thanks a lot for the information. i was able to get it to work with orthographic projection when i multiplied it by -1. i wasn't able to figure out how to get it to work by flipping the if statements though.
@thenukdevendra1902
@thenukdevendra1902 4 жыл бұрын
1 of the only youtubers that actually explain in a way that even beginners can understand.
@nabilbensafi
@nabilbensafi 3 жыл бұрын
Hi , I appreciate the video. Just a quick question : so I'm working on a simple 2D side scrolling runner, the idea is to deliver Pizza to randomly generated houses : green red and blue ( to add a bit of challenge ) , will the script you provided in this video work ? I've been trying for so long but I can't make the houses spawn after the player collides with them. Any help would be appreciated. Thanks.
@DJ-xx7qi
@DJ-xx7qi 4 жыл бұрын
Is there a way to cycle through several asteroid prefabs in the spawn?
@amor6611
@amor6611 4 жыл бұрын
I have a small question, I'm shooting bullets, although it seems I'm creating multiple bullet game objects and I only want to fire one of them when the space key is pressed, how do we limit the rate of a prefab?
@Berniebud
@Berniebud 5 жыл бұрын
9:35 OK FINALLY I was so confused because nowhere could I find where you actually reference the prefab itself god bless you
@davidtelloph
@davidtelloph 4 жыл бұрын
I dont have it and i already save the script, someone help?
@knightmarerip711
@knightmarerip711 4 жыл бұрын
This is pretty neat and so simple. Very well explained! Excellent job!
@pressstart6864
@pressstart6864 4 жыл бұрын
Thanks dude
@quessure6293
@quessure6293 4 жыл бұрын
my object disappears on play. help
@1984ordep
@1984ordep 2 жыл бұрын
from the amount of LIKES it seems a lot of us have the same issue my self included. they flash quickly at the left side of the screen...
@primebalpreet5214
@primebalpreet5214 2 жыл бұрын
Maybe because of camera. Go to camera and change projection to Perscpective
@apinoita
@apinoita 2 жыл бұрын
@@primebalpreet5214 kiitos! (Thanks in finnish)
@darkknight2825
@darkknight2825 Жыл бұрын
@@primebalpreet5214 thanks that works
@eduardo-zf2eo
@eduardo-zf2eo Жыл бұрын
@@primebalpreet5214 thx 🙏🏻
@figgi_myestrio5092
@figgi_myestrio5092 4 жыл бұрын
I was searching for a solution for months and you explained it very finely. I liked and subscribed. :) Thank you. :)
@Thornlock
@Thornlock 5 жыл бұрын
Great tutorials dude! Really hope you keep making these
@pressstart6864
@pressstart6864 5 жыл бұрын
Thornlock thank you for the support. I’ll be taking off the month of December to work on another project but after that I’ll be posting at least once a week.
@Nerodess
@Nerodess 4 жыл бұрын
I followed your tutorial step by step. My script is identical to yours (have checked for 1h). But nothing seems to spawn. If I put an asteroid manually in, it does, what it should. but if I remove it and try using the prefab, it just doesn't spawn anything... pls help! (using the 2019 Version of unity)
@Dorodigital
@Dorodigital 11 ай бұрын
yeh this is Bull! same thing happened to me no spawn
@gokcekapci
@gokcekapci 2 жыл бұрын
Maybe you won't answer but I still want to ask. You wrote the respawn time as "WaitForSeconds(RespawnTime), but I want it to create a new object for each disappearing object condition, not time. So the respawn condition is for another object to disappear. How can I do this? Thanks in advance for the information you will provide. I wish you good work.
@jadthoumy8561
@jadthoumy8561 4 жыл бұрын
hey mate, I'm having issues I've copied and pasted the same code for destroying the asteroids but they are being destroyed at runtime, any suggestions? Please respond me fast, I have an assignment to finish
@vletsy
@vletsy 5 жыл бұрын
Idk if your still respone but i have an question how to let the astriod fly down unstat of to the left
@pressstart6864
@pressstart6864 5 жыл бұрын
Change the velocity to be on the Y axis
@anttiuusoksa549
@anttiuusoksa549 4 жыл бұрын
@@pressstart6864 I am beginner of coding and my question is what I have to do to change the velocity to y axis. Hope you respone quickly
@kingmuzzy
@kingmuzzy 4 жыл бұрын
My object will not delete when off the screen not sure why maybe there is a problem with the camera bounds , any suggestions? (I had to change the code to what you put in the comments, to make my prefab appear on the screen as it wasn't showing with your original code)
@julian_phoenix
@julian_phoenix 3 жыл бұрын
Bro, you're AWESOME. The only one in the whole World Whide Web who helped me out with exactly what I needed. Muchas gracias
@erika2_2
@erika2_2 3 жыл бұрын
At 9:01 you said we could use a boolean that changes to true when the game is ready to start. How do I know when the game is ready to start? Because my game has a title and doesn't start right away, so i dont want the enemies to spawn before the game actually begins, but how can I do this?
@jahmaijones6331
@jahmaijones6331 5 жыл бұрын
If i were to do this for a top down shooter i should just replace the values with Z instead correct ? im trying to do this for a top down space shooter
@pressstart6864
@pressstart6864 5 жыл бұрын
It's relative to your camera. You could just rotate your camera or yes change certain values. Not every project is going to be the same.
@psychospoiler
@psychospoiler 4 жыл бұрын
This really helped me for my mini platform game assignment. Thank you!
@SebastianDrews
@SebastianDrews 5 жыл бұрын
Thanks man, just what I needed, will definitely use this knowledge for my project! :)
@MyThatsCrazy
@MyThatsCrazy 5 жыл бұрын
i'm getting an error saying object referance is not set tto an instance of an object for this line of the code and its saying it for both scripts screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z)); any one have any suggestions on how to fix this?
@pressstart6864
@pressstart6864 5 жыл бұрын
You need to set your main camera. Basically it's just a tag in the inspector. Set it to main and the code will work
@matheussouza7758
@matheussouza7758 4 жыл бұрын
Thanks for the video. Is there any problem of moving the player X or Y on a infinite runner instead of keep the player stood still and move the bg?
@_pratyush
@_pratyush 4 жыл бұрын
Hey can anyone help me! My Game Object (Asteroid) is spawning way behind the camera view and gets destroyed.
@LeoK51
@LeoK51 3 жыл бұрын
me too
@lildgamedev6885
@lildgamedev6885 Жыл бұрын
Hey this is great thanks! my question is I wanted to add a different object to be spawned so I made a new coroutine, but for some reason that one never spawns its object. Is the first coroutine interfering?
@daichi_devs
@daichi_devs 4 жыл бұрын
Hey man just wanted to say this was such a great help for me. You are awesome, keep it up!!
@jameswood4853
@jameswood4853 3 жыл бұрын
I’m am working on a project for college and this really helped me out, however I’ve been trying to connect it alongside a network manager and I can’t get the second asteroid script to work like they just don’t spawn in. Any tips?
@boniebob7200
@boniebob7200 4 жыл бұрын
When the camera projection is "perspective" the objects despawn normally, but when I set it to "orthographic" the objects spawn faster than they can despawn. Can anyone help, plaease?
@victor1102
@victor1102 3 жыл бұрын
Thanks for the video! Just one question, why use this.GetComponent instead of just GetComponent? Thanks!
@ivanpopovic9501
@ivanpopovic9501 4 жыл бұрын
hey, i have problem, when my first prefab gets destroyed, unity stops cloning it since it's destroyed any solution for this?
@lassespfs4570
@lassespfs4570 4 жыл бұрын
Dont have your prefab in your scene just add it to the camera
@randomdev9976
@randomdev9976 2 жыл бұрын
dude you give me a jumpscare with that intro
@nxt_tim
@nxt_tim 4 жыл бұрын
How would you try giving the spawning transforms of the 2nd spawning object a bit of a minimum distance from the spawn transforms before? What I mean more precise: I want to spawn several objects in a scene but they won't move nor disappear after they spawned. They should spawn in a pre-set area with a pre-set number of objects that spawn, but they should all have a minimum distance around them, so that the meshes won't overlap. I'm still rather new to coding so I'm not always quite sure what can and can't be done, would appreciate the help ':D
@tomsted2902
@tomsted2902 4 жыл бұрын
Simply amazing. It's hard to find such a good quality tutorials like yours. Thanks a lot :)
@huzaifa8530
@huzaifa8530 2 жыл бұрын
He does not even damn!! Explains it Whats the thanks for
@AhmedAymanM
@AhmedAymanM Жыл бұрын
The screenboundaries code is correct, it should be something like this: if (transform.position.x + screenBounds.x < 0)
@TheHumanSystem
@TheHumanSystem 2 жыл бұрын
This was very helpful, thank you! You describe it well. I was able to get this to work, but the scene REALLY slowed and became very choppy in play motion. It is a simple 2D low resolution game, but there are about 200 gameobjects as this is the biggest scene. Is that an issue? It runs perfectly before adding this script with no lag or even a hint of issues.
@TheHumanSystem
@TheHumanSystem 2 жыл бұрын
UPDATE: After I added it to a different (smaller) scene, it didn't seem to be an issue and even after I deleted it from the (larger) scene it was still choppy. I rebooted and still choppy, so I guess my computer was just getting over loaded with too many gameobjects.
@caseymckinney8377
@caseymckinney8377 5 жыл бұрын
Also is there anyway to code it so instead, it seems like the enemies are 'dropping' from the top of the screen to the bottom?
@pressstart6864
@pressstart6864 5 жыл бұрын
Yes just reverse the code to work for the Y axis: a.transform.position = new Vector2(Random.Range(-screenBounds.x, screenBounds.x), screenBounds.y * 2); Then modify the velocity also, or just add gravity.
@caseymckinney8377
@caseymckinney8377 5 жыл бұрын
@@pressstart6864 Amazing; thank you so much! Currently working on a game for my university assignment, and your tutorials are a HUGE help!
@gregbriggs9225
@gregbriggs9225 4 жыл бұрын
So I believe as TaniCorn is pointing out, it should be pronounced co-routine, not Quarantine, although that's all been on our mind recently. EDIT Thanks for the great vid!
@SanityPotion776
@SanityPotion776 5 жыл бұрын
Hey! great tutorial! Is there a way to increase the rate at which the astroids spawn over time? I would like them to spawn more frequently as the game progresses.
@zedgaming4756
@zedgaming4756 4 жыл бұрын
i have the exact same question
@sameeragrawal2897
@sameeragrawal2897 2 жыл бұрын
Decrease the respawn time variable value
@elcolorblind4700
@elcolorblind4700 5 жыл бұрын
hey , i dont know why i cant put a prefab as you do in your video. It simply does not give me the option :/ what do i do?
@pressstart6864
@pressstart6864 5 жыл бұрын
Hey, to create a prefab you need to drag your GameObject from the Scene window to the Project Window.
@OliverJ440
@OliverJ440 2 жыл бұрын
Thx. This is mega helpful. I have been looking for this for a long time, now i found it!
@quacks4321
@quacks4321 4 жыл бұрын
i really like your tutorial. But i want to make a game that needs to spawn obstacles from above and when i tried changing the code i couldn't figure out how to make the spawn above (on the x axis) please help me out.
@tuando8511
@tuando8511 5 жыл бұрын
Hello, why do i have this error? MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
@pressstart6864
@pressstart6864 5 жыл бұрын
You probably put the code in the wrong place.
@charlado8597
@charlado8597 Жыл бұрын
@@pressstart6864 i put it in the camera
@milo1269
@milo1269 4 жыл бұрын
I was wondering how you would make the Asteroids spawn downwards vertically, instead of horizontally. Thanks.
@milo1269
@milo1269 4 жыл бұрын
@KeepenCool Thanks! I managed to get it working!
@Prankbros299
@Prankbros299 2 жыл бұрын
@@milo1269 pls can u explain it to me how
@Skildepadde
@Skildepadde 4 жыл бұрын
Hey, can someone help me with a problem I am running into? So I am trying to make this script but instead of the asteroids going sideways I want them to go down so I did that but now the asteroids are going down on one line. In the "deployAsteroids" script I have tried to change "screenBounds.x * -2" to "screenBounds.y * -2" I have also tried to change the Random.Range screenBounds to x instead of y. Btw I am a beginner coder so I am sorry if it is something obvious.
@ahnungsloser4157
@ahnungsloser4157 4 жыл бұрын
Hey! There is a bug .... My Obstacles dont despawn and are spawning only there where the camera startet but when the camera is in another position the Obstacles are still spawning there where the camera was at the beginning... Can anyone help?
@kubakakauko
@kubakakauko 5 жыл бұрын
I will leave this comment just for stats. i would love for your channel to get big
@pressstart6864
@pressstart6864 5 жыл бұрын
Thank you for the support :)
@krishshah1806
@krishshah1806 4 жыл бұрын
For some reason, whenever I run my game, the asteroid disappears right way. Anyway I can fix this issue?
@lordcatington8188
@lordcatington8188 3 жыл бұрын
Idk if you still need this but change the camera to perspective (I had the same problem, this just doesn't work with orthographic that's all)
@Iontaraxia
@Iontaraxia 3 жыл бұрын
@@lordcatington8188 had same problem as his, thanks m8
@ethannewman963
@ethannewman963 3 жыл бұрын
@@lordcatington8188 Thank you so much you really helped me
@AaronDerpy
@AaronDerpy 3 жыл бұрын
@@lordcatington8188 Thank you very much!!
@sharaharan3483
@sharaharan3483 2 жыл бұрын
Hi , I tried it for Y axis, but the "DEPLOYASTEROID.CS" did not work for me. I tried changing the x axis to y axis, but the spawning didn't work. Pls help me. Thank you.
@gabrielbrazeau835
@gabrielbrazeau835 2 жыл бұрын
Super video!! Only thing is that you've could use the asteroid width instead of the (* 2/-2), but for the rest great job !!
@jangramann4411
@jangramann4411 2 жыл бұрын
thanks!!!
@flamed4967
@flamed4967 4 жыл бұрын
My enemies are just spawning off to the side not even in game view :/ Any help?
@JaquanGrand
@JaquanGrand 4 жыл бұрын
mines to any help
@JustDoom
@JustDoom 4 жыл бұрын
same
@mikemitchley384
@mikemitchley384 3 жыл бұрын
Hi, how do i change the amount of objects spawned at a time i want to increase it as the game continues?
@davidregalado3037
@davidregalado3037 2 жыл бұрын
How can I make more obstacles spawn through the progress of the game? Also great tutorial.
@MrChubbyCheeksss
@MrChubbyCheeksss 4 жыл бұрын
Your method is simple and great but whats the difference on your coroutine against invokerepeat?
@Christ0hell
@Christ0hell Жыл бұрын
Not sure what i have done wrong here but the object i want to be deleted off screen immediately deletes itself. Checked code over and over not sure what i am missing.
@cookieceleste
@cookieceleste Жыл бұрын
In the Update method, try multiplying your "screenBounds.x" by -1, like this -> if (transform.position.x < screenBounds.x * -1). Looks like the problem is he was using his camera on "Perspective" mode, when most of the time we use it on "Orthographic" mode for 2D projects, and that reverses some things.
@cgnotavailable
@cgnotavailable 2 жыл бұрын
What is the best resolution to an image to get it to
@markrepac9739
@markrepac9739 3 жыл бұрын
i need help because when my mane object is destroyed the clones are not spawning any more can someone tell me whats wrong
@jansvec3855
@jansvec3855 3 жыл бұрын
If i want spawn only one prefab after the Last one prefab is destroyed. How i can do that?
@Sheffy_TF2
@Sheffy_TF2 2 жыл бұрын
when i use the Removing objects from the scene once they leave the screen script its just destroys the objects even if its seen by the camera
@caseymckinney8377
@caseymckinney8377 5 жыл бұрын
my enemies just seem to glitch off the other side of the screen, without appearing in the game view at all; any help
@pressstart6864
@pressstart6864 5 жыл бұрын
Is your camera moving or is it static?
@caseymckinney8377
@caseymckinney8377 5 жыл бұрын
@@pressstart6864 It appears static, but it turns out it's technically moving? I tried the code you suggested to someone having a similar issue and it resolved my problem :)
@juncooo7505
@juncooo7505 4 жыл бұрын
@@pressstart6864 I have the same issue. My camera is moving
@JaquanGrand
@JaquanGrand 4 жыл бұрын
@@caseymckinney8377 what was the code you used to fix this issue
@rohitrana2312idk
@rohitrana2312idk 3 жыл бұрын
@@JaquanGrand I had the same problem, idk why. I destroyed the item with a timer, instead of screenbounds
@dimigif526
@dimigif526 4 жыл бұрын
great tutorial dude but I have a little question how do I make the enemies disappear after leaving the screen on a moving camera?
@mando7176
@mando7176 5 жыл бұрын
I encountered a problem here. my clone of asteroid spawns for a few miliseconds, then after the main one get destroyed, no clone spawns..'
@abdullahali7237
@abdullahali7237 4 жыл бұрын
same
@anhtuan528
@anhtuan528 3 жыл бұрын
Could you please explain why did you multiply the bounds to -2 but not 2? 2 sounds more legit to me actually. Follow up question is could you have a video explaining what is Camera.main.ScreenToWorldPoint? I read the API but have no idea what they're saying. Thank you very much.
@notbotpot7559
@notbotpot7559 4 жыл бұрын
i followed everything step by staep and even copy and pasted the code but i get the errors the asteroids arent spawning heres the errors NullReferenceException: Object reference not set to an instance of an object asteroid.Start () (at Assets/asteroid.cs:17) and NullReferenceException: Object reference not set to an instance of an object NewBehaviourScript.Start () (at Assets/NewBehaviourScript.cs:14)
@rojinx4162
@rojinx4162 5 жыл бұрын
The line if(transform.position.x < screenBounds.x) { Destroy(this.gameObject); } seems to destroy my camera so i cant see anything happening in the game, how can i fix this?
@silver440
@silver440 5 жыл бұрын
void Update () { if(transform.position.x < screenBounds.x * 2){ Destroy(this.gameObject); } } thats what the source code said, i think you might have forgotten the * 2
@rojinx4162
@rojinx4162 5 жыл бұрын
@@silver440 I think i had the script bound to my camera, so the camera would destroy itself lol, and ty for the reply btw
@silver440
@silver440 5 жыл бұрын
Oh lol, I just realized that the * 2 was nothing more than padding, so it shouldn't have affected the camera. Nice job though and good luck 😃
@mando7176
@mando7176 5 жыл бұрын
MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. and says this in console...
@pressstart6864
@pressstart6864 5 жыл бұрын
Follow the video exactly. More than likely you placed the asteroid.cs on the wrong object. It should go on the asteroid prefab.
@ettolamedica9987
@ettolamedica9987 4 жыл бұрын
Potato Is Pro try right clicking on the asteroid (in the herarchy) and press unpack prefab completley
@charlado8597
@charlado8597 Жыл бұрын
@@pressstart6864 i had the same problem
@loghanveilleux
@loghanveilleux Жыл бұрын
it fixed my problem that i was having with my spawn system thanks a lot😎😎😎😎😁😁😁😁😁😁😁😁
@robby.108
@robby.108 2 жыл бұрын
Hey, I have a question. How can I rewrite this code to make the asteroids fall from top to bottom?
@Prankbros299
@Prankbros299 2 жыл бұрын
@Jurgen Thank You so much!
@Prankbros299
@Prankbros299 2 жыл бұрын
@Jurgen But in the code where it destroys it self when it touches the end, it instantly destroys it self when u press start
@noncraftx8790
@noncraftx8790 4 жыл бұрын
I made a game with Camera moves with Player please how script must looks to be good?
@kuritsu6239
@kuritsu6239 5 жыл бұрын
Just a great tutorial as always ! thanks Can you explain us how to create the space background ?
@pressstart6864
@pressstart6864 5 жыл бұрын
I used a particle effect. For start size choose a value less than 0.1 and then under Renderer > Material choose "Sprites - Default". Then just rotate it 90 degrees.
@kuritsu6239
@kuritsu6239 5 жыл бұрын
@@pressstart6864 Great ! It looks so awesome !
@rojinx4162
@rojinx4162 5 жыл бұрын
How do i delete the asteroid after it leaves the y axis? iv used the script: void Update() { if(transform.position.y < ScreenBounds.y * 2) { Destroy(this.gameObject); } } but it deletes itself at any point on the screen.
@rojinx4162
@rojinx4162 5 жыл бұрын
Im using an orthographic camera if that helps
@pressstart6864
@pressstart6864 5 жыл бұрын
If using orthographic camera use -screenBounds.y
@pressstart6864
@pressstart6864 5 жыл бұрын
Or multiply by -1
@stejothepisto
@stejothepisto 4 жыл бұрын
So I'm making a doodle jump game, what do I write instead of screenbounds.x and screenbounds.y???? edit: I'm guessing I have to refer to my destroyer somehow?
@Prankbros299
@Prankbros299 2 жыл бұрын
if u know how to pls tell me
@myworld7667
@myworld7667 4 жыл бұрын
thankyou very much but how i make the rocks move from below to up?????
@abdullahamjad3612
@abdullahamjad3612 5 жыл бұрын
sir How can i apply such CODE in an 3d runner game when camera is from behind
@idriveships4047
@idriveships4047 5 жыл бұрын
i have the same question
@deraminator945
@deraminator945 3 жыл бұрын
Is there anyone who did the same but in 3D? I tried but that didn't went well
@DH-yb7fz
@DH-yb7fz 3 жыл бұрын
This actually worked for me! Thank you so much!!
@AykutKaramanTV
@AykutKaramanTV 4 жыл бұрын
ORTHOGRAPHIC CAMERAS objects do not come out. How can we find a solution?
@AykutKaramanTV
@AykutKaramanTV 4 жыл бұрын
Objects are outside the screen. How can we put the screen inside. ?
@revel6016
@revel6016 4 жыл бұрын
How do I spawn it in just a staight line?
@shmowp5379
@shmowp5379 4 жыл бұрын
my code says that Random is an ambiguous reference to unityEngine.Random and System. Random what do i do to fix this? if i add system.random my game says Random does not contain a definition for range
@lachw4285
@lachw4285 4 жыл бұрын
same
@mcbobber6913
@mcbobber6913 3 жыл бұрын
It doesn’t say any errors but it won’t spawn the asteroids
@gattra
@gattra 4 жыл бұрын
Great video thank you. Why do you name your functions and classes without capitalizing the first letter?
@lukakresoja5297
@lukakresoja5297 4 жыл бұрын
Standarsation by a unwritten rule all variables are named like this : respawnTime , isColided , smoothingDone , isDeadByGravity (with the first letters uncapitalised)
@ecapgaming2931
@ecapgaming2931 4 жыл бұрын
It is great but what is corontine it says it doesn’t exist plz help when I delete it they don’t spawn 😢😢😢
@mehva7382
@mehva7382 Жыл бұрын
does this also work up and down? not just left to right
@thanasisrks4944
@thanasisrks4944 4 жыл бұрын
Thank you, this was very helpful, but it would be so much better how do to increase the spawn rate of the asteroids!
@kdesh3336
@kdesh3336 4 жыл бұрын
decreasing the respawnTime should work and increasing the respawnTime should make them spawn slower hope this helps :)
@dragonballz3686
@dragonballz3686 2 жыл бұрын
Bro, how to make a set of enemies coming in a straight line or forming sine wave or in a circle formation like space shooter games.
@VeryHappyCat
@VeryHappyCat 2 жыл бұрын
Can you make it so that the clones get slowly faster the longer you play?
@BhargavMarpu
@BhargavMarpu 4 жыл бұрын
Thanq for the clear explanation.. It helped a lot :)
@suspoocha
@suspoocha 2 жыл бұрын
asteroid look sick
@mrhopeis6134
@mrhopeis6134 2 жыл бұрын
This helped so much in my game. Thank you
@j0kerplayz766
@j0kerplayz766 4 жыл бұрын
What do i have to change if i the camera moves with the character, doesnt seem to work there. Nice Video BTW!
@danyalkhan8923
@danyalkhan8923 4 жыл бұрын
Same here, if you find a good way to do it Lmk
@Prankbros299
@Prankbros299 2 жыл бұрын
Is there a way that the astroids spawn in the top and go under?
@elotusa
@elotusa 3 жыл бұрын
My unity doesnt allow me to add onto my deloyasteroid script qwq idk how to make it work and its the same code used here
@謝宗佑-u1m
@謝宗佑-u1m 5 жыл бұрын
Rocks stop spawning after one of them being deleted, how can I keep them spawning?
@pressstart6864
@pressstart6864 5 жыл бұрын
You're probably deleting the object that spawns the obstacles. Try deleting the obstacles individually instead.
@謝宗佑-u1m
@謝宗佑-u1m 5 жыл бұрын
@@pressstart6864 I found where the problem was, I forgot to delete the prefab in the scene before launching the game LOL
@Changelllelle
@Changelllelle 5 жыл бұрын
Did you create a folder in assets called prefabs and added the rock in there? Then assign the rock from the prefab folder to the script that deploys the rocks, located in the main camera.
@nosegoatpolo5883
@nosegoatpolo5883 4 жыл бұрын
How did you solve the problem?
@Abraham-om5ib
@Abraham-om5ib 4 жыл бұрын
@@Changelllelle wow thank you that was it :)
@ohnsonposhka9891
@ohnsonposhka9891 5 жыл бұрын
Clean explanation.. Great work
@pressstart6864
@pressstart6864 5 жыл бұрын
Thank you!
@Prankbros299
@Prankbros299 3 жыл бұрын
The asteroids doesnt start at the right side. It starts in the middle. Does anyone know what to do?
@liamtinney5759
@liamtinney5759 5 жыл бұрын
my script completely ignores what i typed and destroys the gameobject instantly
@ehawknut3797
@ehawknut3797 5 жыл бұрын
Please help me. Mine does the exact same thing.
@PraveenKumar-pj9ls
@PraveenKumar-pj9ls 5 жыл бұрын
@@ehawknut3797 me too faced the same problem. Screenbounds.x gives me positive value (don't know how), so i gave minus in front of screenbounds.x inside if condition and works fine now.
@CanisMajoris_star
@CanisMajoris_star 5 жыл бұрын
​@@PraveenKumar-pj9ls This worked for me. Thank you
@Rxbsi
@Rxbsi 4 жыл бұрын
Make - 25 instead of * 2
@daynemoore7816
@daynemoore7816 2 жыл бұрын
you aren't a setup master without a set of cans around your neck.. I'm wearing a set now even though I don't know what I'm doing! LOL!
@zenitherr
@zenitherr 3 жыл бұрын
i took the prefab and put it in the camera on the script but nothing is creating. i did exactly what you did.
@allengullon624
@allengullon624 4 жыл бұрын
Hello how to instantiate prefab to the main camera position?
Unity - Enemy Follows Player [Beginner Tutorial]
6:51
Press Start
Рет қаралды 184 М.
Unity Movement [RigidBody vs Translate]
9:00
Press Start
Рет қаралды 284 М.
Expected Ending?
00:45
ISSEI / いっせい
Рет қаралды 11 МЛН
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 10 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 11 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 224 МЛН
How To SPAWN ANYTHING in your Game with Unity Tutorial
10:45
The Ultimate Introduction to Scriptable Objects in Unity
20:45
Bedrock. Why?!
22:37
FundyLIVE
Рет қаралды 326 М.
A Perfect Jump in Unity - A Complete Guide
17:05
Press Start
Рет қаралды 76 М.
How I Made a 3D Platformer in 2D Game Engine
21:23
ggenije
Рет қаралды 495 М.
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 697 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,1 МЛН
How to make Snake in Unity (Complete Tutorial) 🐍🍎
47:24
Zigurous
Рет қаралды 188 М.
Unity Tutorial | Spawning Random Enemies at Random Times and Positions
15:52
Expected Ending?
00:45
ISSEI / いっせい
Рет қаралды 11 МЛН