No video

3D ENDLESS RUNNER IN UNITY - OBSTACLES (Pt 3)

  Рет қаралды 48,458

Practical Programming

Practical Programming

Күн бұрын

Playlist: bit.ly/endless-runner-in-unity
Github: github.com/SK-Studios/3D-Endl...
In the third part of this beginner series on creating a 3D endless runner in Unity, we will be creating the obstacles. We will spawn an obstacle on each tile, and restart the game if the player hits one of them. We will also restart the game if the player falls off the edge of a platform.
.............................................................................................
All Unity Tutorials: bit.ly/all-unity-tutorials
Beginner Unity Tutorials: bit.ly/unity-beginner-tutorials
Intermediate Unity Tutorials: bit.ly/unity-intermediate-tut...
Main Menu in Unity: bit.ly/unity-main-menu
Endless Runner in Unity: bit.ly/endless-runner-in-unity
.............................................................................................
♥ Subscribe: bit.ly/sk-studios-youtube
● Instagram: / _skstudios_
● Itch: sk-studios.itch.io
..............................................................................................

Пікірлер: 95
@MrYanissab
@MrYanissab 3 жыл бұрын
OMG this is so good ! the sweetest voice too ! haha a pleasure learning with you !
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thank you so much, I really appreciate it! Glad I could help you too :))
@julianiano
@julianiano 2 жыл бұрын
Everything is explained exactly how it works. Very good teacher👍I love your channel and your videos :)
Ай бұрын
Great tutorial, thank you. For some reason my player goes through the obstacles and it doesn't stop the game, also, it falls over sometimes
@Grey2Heavymental
@Grey2Heavymental 2 жыл бұрын
Another great one!!! I can't wait to see how this turns out. Your explanations are truly great. "Invoke" seems so simple to remember now.
@ameliapl868
@ameliapl868 2 жыл бұрын
Thanks yo so much for this video series, it helps me a lot with a work for class, Im an animator and developer gaming student
@abdoumurad6080
@abdoumurad6080 3 жыл бұрын
Great Video, I feel like if you improve the little things I can see you being a big channel. The content is great and is similar if not better to those channels with thousands of subscribers
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thank you! I know that my microphone quality isn't the best right now, but what other suggestions do you have for me to improve? Any feedback is always welcome 😊
@luciaansaldi5518
@luciaansaldi5518 Жыл бұрын
Excellent!!!!!! I love you so much.
@Alien.Of.Mars.
@Alien.Of.Mars. 2 жыл бұрын
Thanks man looking for this.....
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
You're welcome :)
@Morrisonfam2020
@Morrisonfam2020 3 жыл бұрын
Wow Cool Video
@user-we6si4mi3x
@user-we6si4mi3x 3 жыл бұрын
Very Great !
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Thanks :))
@goodsonguitars
@goodsonguitars 2 жыл бұрын
Thanks Sir! earned a sub nice work.
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Thanks, I'm glad I could help :)
@TheQuerroDerBoss
@TheQuerroDerBoss 4 ай бұрын
I Have a problem where my obstacle does not spawn on the predefined obstacle spawners. They spawn on the right side of my platform and are hanging halfway over the edge. My code looks exactly like the one in the video and i dont know why its not working
@AviGgamedev
@AviGgamedev 3 жыл бұрын
just wanted to say amazing series i have been having a blast making an endless runner by following your tutorials hope you keep doing more just one question i have used a custom asset which i made in blender as the ground and after typing the same code in the video to spawn the coins , the coins end up spawning in the middle of the ground ,how do i fix this?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Hey Avi, thanks for the feedback - it's wonderful to hear! The height that the coins spawn at (y-position) is set in the GetRandomPointInCollider function in the GroundTile, when we say "point.y = 1;". If the coins are spawning in the middle of the ground, they are spawning too low down on the y-axis, so try changing that value something higher, and that should solve your problem. I hope that helps - if the problem doesn't go away, feel free to reply and I'll see what I can do to help :)
@nyrader6674
@nyrader6674 2 жыл бұрын
How would you make it so an obstacle does not spawn in the same position two times in a row? For example, if the first tile spawns an obstacle in the left position I don't want the next tile that spawns to also spawn the obstacle in the left position.
@shafiullahansari639
@shafiullahansari639 3 жыл бұрын
Hello Sir, I am new to unity and I am developing a car game till now I have developed endless road using 3 prefab object(road) now i want to generate some obstacles like truck, ambulance etc on all the 3 prefab object but you have used a single obstacles and i want to use multiple obstacles using array function. I am little bit confused so could you please help me to fix this problem and tell me what am i doing a mistake
@ashtonobrien1043
@ashtonobrien1043 Жыл бұрын
Hey, for some reason at random times, my player is colliding with the gap between where the new tiles are spawning one after another, it also lowers my player from 0.5 on the y to 0.499 and it just completely stops the game and looks like you are colliding with an invisible object
@stykerz3254
@stykerz3254 3 жыл бұрын
Thank you finally making an app. Never expected it Edit: Pls help it shows Assets\Scripts\Obstacle.cs(24,1): error CS1022: Type or namespace definition, or end-of-file expected 11:07 Pls reply asap
@kim_liaa
@kim_liaa 3 жыл бұрын
Hey guys! If someone need to create randomize between multiple gameobjects (obstacles), edit Instantiate(obstaclePrefab, spawnPoint.position, Quaternion.identity, transform) to Instantiate(obstaclePrefab[Random.Range(0, obstaclePrefab.Length)], spawnPoint.position, Quaternion.identity, transform) and edit public GameObject obstacles to public GameObject[] obstacles
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks for helping everyone out! Just letting you guys know we do cover this later in the series though :)
@kim_liaa
@kim_liaa 3 жыл бұрын
@@PracticalProgramming Thank you very much)
@logeinn_3396
@logeinn_3396 3 жыл бұрын
Hello when i create empty and write obstaclespawnleft and other 2 with middle and right if i closed the ground tile it gets deleted and just appears only in the 1st ground that i put before playing . So i tried to make 3 obstacles and make in the code obstacle prefabs array and added 3 element and completed with the same code so right now only obstacle in the middle is the one appearing i revised the code multiple times before adding the array and after it and im using version 2017 of unity
@idcemail123
@idcemail123 Жыл бұрын
How did you learn to program unity? To make this game did u follow a tutorial at first or just use docs.
@tqacks1769
@tqacks1769 3 жыл бұрын
when i start the game, the obstacles only spawn on the left side of the ground tile, and i have no errors, the childs numbers on my ground tiles are the same as in the video, any help? (edit: i tried changing the child numbers, so i switched between right and left child, and the obstacles still spawn on the left, meaning its only spawning on the left because of the script, but i have the random.range so i dont understand why, i also tried setting the random.rage to 3, 5 so it dosent use the left obstacle child, but it still used it.)
@KBforJesusChrist
@KBforJesusChrist Жыл бұрын
How can spawn platforms like the one you are running with perfect alignment and no merging, stacking or random rotation and stretchs
@thegamingcentre4288
@thegamingcentre4288 3 жыл бұрын
Congratulation, you just got a sub from this :D Edit: how to spawn them randomly?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks! I cover random obstacle spawning later in the series, so just keep watching :)
@mattw6399
@mattw6399 2 жыл бұрын
I also subbed after this, he's slow enough for you to understand and get everything, but not to slow that you get super bored.
@xvisionproductions
@xvisionproductions 3 жыл бұрын
Great tutorial! I just have one minor issue, in the part when coding the obstacle, at 7:37, when you put PlayerMovement, the code appears in green showing that it works, but when I typed that, it didn't look like that, and then when I put what you put at 7:44, the code was giving me an error sign because it didn't know what PlayerMovement was. Any tips on how to solve this?
@reefoo2070
@reefoo2070 3 жыл бұрын
Hi i have the same problem and i am struggling how did you fixed it Please?
@xvisionproductions
@xvisionproductions 3 жыл бұрын
@@reefoo2070 Hi, for me the problem was that PlayerMovement wasn't the name that I gave the script which is being referenced, so when I was following the tutorial I put in PlayerMovement instead of the name for my script. If it's the same issue for you make sure that the name you put on the variable is the same exact name as the script you're trying to reference
@reefoo2070
@reefoo2070 3 жыл бұрын
@@xvisionproductions THHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANNNNNNNNNNNNNNNNNNKKKKKKKKKK YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! you can not imagine how this comment is so helpful I am building a game for a college scholarship and I almost gave up thanks again !!!
@xvisionproductions
@xvisionproductions 3 жыл бұрын
@@reefoo2070 No problem!
@mattw6399
@mattw6399 2 жыл бұрын
I have had this problem so many times, I always realize when I start all over and try things again. N it almost got me in this one because he made the script Player Movement, and i just called mine move.
@malithmadhawa4714
@malithmadhawa4714 Жыл бұрын
Hi, Why does my obstacle doesnt show up while Im playing even though I followed your tutorial ??? Could you help me ??
@jeffreyjumisko5165
@jeffreyjumisko5165 3 жыл бұрын
This is a very good series. One question: For some reasons, the Directional Light is removed when on the Restarted game. Any ideas why?
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Sorry, I'm not sure what's causing the light to delete itself. It's been a while, but I don't remember that happening in my game. Perhaps try downloading the project from GitHub (link in the description) and see if there's anything different between them? Sorry that I couldn't help more.
@CivoHD
@CivoHD 2 жыл бұрын
You can fix it by going to Window - Rendering - Lighting. Then click on New Lighting Settings And Checking Auto Generate
@bumba.clart123
@bumba.clart123 2 жыл бұрын
My invoke method isn't working, I've typed in the same as you did
@serhatholmes
@serhatholmes 3 жыл бұрын
It's a very good tutorial, thanks for this. I have a question. When the Player die, the scene light also disappear and after playing without light source. How can I fix that?
@jeffreyjumisko5165
@jeffreyjumisko5165 3 жыл бұрын
I had the same thing happen. I have not yet found out why.
@jeffreyjumisko5165
@jeffreyjumisko5165 3 жыл бұрын
My workaround was to attach a directional light to the ground tile Prefab. It works okay. Not sure how resource effective it is. I found point lights did something weird to some walls I created with pro builder Snaps objects.
@mitch516
@mitch516 2 жыл бұрын
Perhaps you need to uncheck "auto generate" lighting and generate the scene light in the ligthing settings.
@smitrajrana4016
@smitrajrana4016 4 жыл бұрын
Can you explain the line : Transform spawnPoint = transform. GetChild(). transform; I don't understand why we are using transform two time.
@PracticalProgramming
@PracticalProgramming 4 жыл бұрын
Sure! This script is attached to the ground tile prefab, so the first transform gets the 'transform' component of the ground tile. Transform is the component that contains the position, rotation and scale of the object, however, it also contains information about the children of an object (if you need further clarification on child objects feel free to drop another comment and I'll gladly explain it). So transform.GetChild() gets a reference to the child object. The second transform is referring to this child object's transform, i.e. the position of the spawn point. In short, the first transform gets a reference to the transform of the ground tile (which is necessary to get child items), and the second one gets a reference to the transform of the spawn point. I hope that clarified your issue, if not please reply and I'll try to explain the best I can in more depth :)
@smitrajrana4016
@smitrajrana4016 4 жыл бұрын
@@PracticalProgramming Got it!
@sarahkhelil7017
@sarahkhelil7017 3 жыл бұрын
thank you for this video but how I can minimize the number of obstacles ?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Later in the series we look at generating random obstacles - you can simply make "nothing" one of the obstacles to reduce the number of them. Another possible solution is to make the ground tiles longer on the z axis. I hope that helps :)
@nevgongivup2560
@nevgongivup2560 2 жыл бұрын
hey can u tell what kind of physics should i give for obstacles actually i am making an endless runner in unity, not this one but i still wanna know what physics do u give for obstacles
@tohmas1558
@tohmas1558 2 жыл бұрын
just a box collider
@nevgongivup2560
@nevgongivup2560 2 жыл бұрын
@@tohmas1558 thanks
@ayonimimartin874
@ayonimimartin874 3 жыл бұрын
Also does this thing work with rigid body's?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Yes this whole project is set up using rigidbodies :) If I misunderstood your question please let me know and I'll do my best to help :)
@crispybeans7330
@crispybeans7330 2 жыл бұрын
I get an error "Transform Child out of bounds" ????
@ankam327
@ankam327 3 жыл бұрын
Hey! I downloaded a different 3d object to use as an obstacle and after following all the steps my player still passes through my obstacles even though the game restarts when he falls off the plane. Is there any way to fix that?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
This should still work even if you use a different model. If your player is passing through the models, first check whether the Obstacle prefab has a collider on it (you can see in the Inspector). If it does, make sure "Is Trigger?" is set to false. If all of that is already done, make sure that your player has a Rigidbody component. I hope that helps :)
@ankam327
@ankam327 3 жыл бұрын
@@PracticalProgramming Yes, I had to add a collider. Thank you :)
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Glad you managed to sort it out :)
@hieungo7766
@hieungo7766 3 жыл бұрын
I have an error that appears 2 (obs) on the same row, can you help me fix it?
@hieungo7766
@hieungo7766 3 жыл бұрын
I found my mistake, thank you
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Glad you managed to solve it :)
@radajz3153
@radajz3153 3 жыл бұрын
I'm sorry to bother you again, but I typed in the code and did everything nicely but I got this error, and my player is not moving: UnassignedReferenceException: The variable obstaclePrefab of GroundTile has not been assigned.
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
That's not a problem with the code, that means you didn't assign the object in the inspector. Go back to the part of the video where I go back to the editor and make sure you assign the object to the variable.
@radajz3153
@radajz3153 3 жыл бұрын
@@PracticalProgramming Oh, i fixed it, but ground is dissapearing randomly. How to fix it?
@ayonimimartin874
@ayonimimartin874 3 жыл бұрын
Hello SK just wondering why a big hole appears in the middle of my map
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Um... I can't tell just from that, I would need more information - does the hole appear after every tile? Also I put a link to a github repository where you can download the finished scripts to compare them with yours :) I hope it's helpful!
@ayonimimartin874
@ayonimimartin874 3 жыл бұрын
SK Studios um so when I add rigid bodies to my project one big hole appears in my map
@ayonimimartin874
@ayonimimartin874 3 жыл бұрын
I added the rigid bodies to the obstacles sorry
@ayonimimartin874
@ayonimimartin874 3 жыл бұрын
@@PracticalProgramming No there is just one big hole after a few seconds when the game has started when my obstacles have a rigid body on them
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Do you mean if you take the rigidbody off your obstacles there is no hole anymore? Have you tried setting the rigidbody to Kinematiic? If not, try that and if it still doesn't work let me know :)
@channelrusakk211
@channelrusakk211 3 жыл бұрын
Can you put script in description? Please
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks for reminding me to do that I completely forgot! I'll upload it to github as soon as I can :)
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Done! Here's the link: Github: github.com/SK-Studios/3D-Endless-Runner-in-Unity Hope it helps :)
@radajz3153
@radajz3153 3 жыл бұрын
my object hits the ground and makes the game restart. Pls help ASAP
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Do you mean the player makes the game restart immediately? If so, make sure the ground's y position is zero and the game over y position is a negative value
@radajz3153
@radajz3153 3 жыл бұрын
@@PracticalProgramming Yes, the ground's y position is set to 0. Player hits the ground and games restart after 1 sec.
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Have you checked the game over y position in the script? (The variable where if position.y is less than it the game restarts)
@radajz3153
@radajz3153 3 жыл бұрын
@@PracticalProgramming wait, can you send me full script here in comments? I might did something wrong,
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
There is a link to a GitHub repository with all of the final code and the entire Unity project in the description where you can check your code (first link). I'm not going to copy and paste the entire script into the comments since that would be messy and hard to read.
@modnashri
@modnashri Жыл бұрын
Hi Thanks for your video but i have something not working. my player doesn't ''Die'' after touching ''Obstacle'' anyone know how to solve this? i found my propblem it was // if (collision.gameObject.name == "player") // after edit //if (collision.gameObject.name == "Player") i need to focus for upper and lower case
3D ENDLESS RUNNER IN UNITY - ENDLESS GROUND SPAWNING (Pt 2)
13:07
Practical Programming
Рет қаралды 66 М.
Festive Eda Guild War Debut - Epic Seven
10:31
Ông Chú Mê Game
Рет қаралды 80
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 165 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 13 МЛН
Это реально работает?!
00:33
БРУНО
Рет қаралды 4,2 МЛН
3D ENDLESS RUNNER IN UNITY - PLAYER (Pt 1)
15:55
Practical Programming
Рет қаралды 92 М.
3D ENDLESS RUNNER IN UNITY - COINS (Pt 4)
22:48
Practical Programming
Рет қаралды 30 М.
TOUCH CONTROLS in Unity!
16:09
Brackeys
Рет қаралды 1,3 МЛН
Unity Endless Game - Part 7 : Generating Infinite Tiles
15:16
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 165 МЛН