Procedural Generation: Endless Runner Unity Tutorial (Updated 2023)

preview_player
Показать описание
Hey friends! Let's learn how to generate infinite levels and platforms in Unity with Procedural Generation! This is a follow-up to a video I made about Subway Surfer, and I thought this would be a good overview on how procedural generation works.

~ Contact ~
📷 Instagram: @rigor_mortis_tortoise
⏱️TikTok: Rigor_MortisTortoise

📖 Chapters
0:00 Intro
0:29 How the effect works
1:02 Invisible Wall Trigger
1:29 Creating a trigger
2:36 Writing the trigger script
5:48 Writing the platform movement script
7:54 Destroy wall
Рекомендации по теме
Комментарии
Автор

Thanks for the tutorial!
---
If anyone have already have forward running character, or you don't want the platforms that sliding backward, you can try this:

Mine SectionTrigger from this tutorial script looks like that:
public class SectionTrigger : MonoBehaviour
{

public float moveStep; //lenght of platform offset on trigger = full exact lenght of platform(fills from inspector)
public int stepCount = 0; //multipler for each next offset(counter of triggers)

public GameObject roadSection;

void OnTriggerEnter(Collider other)
{

{
stepCount += 1;
Instantiate(roadSection, new Vector3(0, 0, moveStep * stepCount), Quaternion.identity);
}
}
}

msx
Автор

Girl I love you, you know how to explain things <3 this tutorial ment so much

marijapopovic
Автор

This is a great tutorial Holly. Glad I found it. Thanks!

KJJHN
Автор

thankyou sister i am from india i am just a beginner but i can able to understand u r english and u r explanation is very very good love from india

etdeink
Автор

Your videos are really nice and helpful, I believe the curve World effect helped me solve a problem in my game. But actually in Subway Surfers the character rather moves instead of the world. I’ve been able to move the camera in the game away from the character and can confirm that the player rather moves which is what I’ve been doing in my game. But this tutorial was actually really interesting, good vid.

EpikFshy
Автор

Thnaks a ton for this tutorial! It really helped me out

yaroslavkelemen
Автор

I was needing this so much... I love your channel ;; omg <3 <3 <3 Thank you so much, new sub and fan <3 <3

kiryrumirz
Автор

Great tutorial as always, cool to learn how things work! ❤ 🔥

Zephyrs_Domain
Автор

Hi from near future, thanks for the good tutorial 👍

r.f
Автор

Hey, i have a problem. i have a section that has a box collider and when the player triggers the box collider, the box collider will deactivate and spawn a new section, but after it spawns a section, the new section it spawned doesn't work anymore, in which the box collider in the new section isn't activated, this is because the prefab is using itself and changes itself, but i don't want that to happen and i don't know how to fix it.

motobikeDev
Автор

When the road section is destroyed I get a MissingReferenceException
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.
If I check for null then my SectionTrigger stops working.

bobwonch
Автор

Just underneath the heart on your icon you need to put the letter "S" because you are SUPER!!!

simonsobo
Автор

Train of thought

How to apply this to rimworld,
A planet like venus with a long day,
Wait what about that planet in riddick that was a blazing inferno and you had to keep moving to avoid death
So like procedurally generated surface on extremely slow rotation planet but the topography does repeat eventually.

DominicRyanOsborne
Автор

Can we get a possible update/re-go over of this? a bit slower, more in depth/detailed? with better steps some feel like they were skipped over. I tried this and the script just seemed to not work at all for me.

Mcjagger
Автор

Can you add random cat generate on? pls

NooB.
Автор

How do we fix gap between new tiles just instantiated?! And im increasing speed but gap appear

SAJJAD-dhxp
Автор

When I add the RigidBody to the road prefab, the sections push each other up or down if you look at the scene from a side view. How can I fix this?

VeryTori
Автор

i want to, like generate new platforms rather than same one ? can anyone help

heytsla
Автор

Do you have any issues with Z-fighting when you spawn the prefabs over each other, or is that something you fix later?

akRedmage
Автор

The destroy wall is not working for me

tgerm