Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by glen_loganx · Oct 25, 2017 at 06:16 AM · navmeshnavmeshagentnavigation

how to generate infinite nav mesh path

Im trying to make an endless runner game like in subway surfers/ highway pursuit games.

A clone copy of the level that ive created is always being constantly generated which is what i want since i want the player to be always moving forward but i cant get the nav mesh path to do this as well. I have an enemy thats always chasing the player using this nav mesh path but i cant get this nav mesh path to automatically be generated also as the world in the level is generated.

Does anyone know of a way that i can do this it would be really helpful or even provide a code sample of this? The code below is the one i used to generate the level i created in my world

public class roadTrigger : MonoBehaviour {

 public Transform roadPrefab;

 // Use this for initialization
 void Start () {
   
 }
 // Update is called once per frame
 void Update () {       
 }

 private void OnTriggerEnter(Collider other)
 {
     Instantiate(roadPrefab, new Vector3(0, 0, transform.parent.position.z+49f), roadPrefab.rotation);        
     transform.parent.gameObject.AddComponent<timetodestroy>();
 }

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Cuttlas-U · Oct 25, 2017 at 06:35 AM

hi; usually in runner games what we have to do is seperating parts of the worlds and saving them as prefabs;

to move the player as i saw before we cant use navigation but we should use waypoint system;

we created some points inside each part of the worlds and when player reach the end of points in 1 world it get the first point in the next world and try to move to it;

as this has been done in subway surfe ;

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image glen_loganx · Oct 25, 2017 at 06:48 AM 0
Share

I did separate parts of the world and save them as prefabs. I made that world and created a copy of it so that the copy would work as a clone

would i need to create a script for the waypoint system or does this come with unity?

avatar image glen_loganx · Oct 25, 2017 at 06:58 AM 0
Share

how would i implement waypoints for the enemy to always follow the user/player in whichever direction they go? Both the user and the enemy travels in one direction which is forward but the user is also able to go both left and right and the enemy should follow that as well based on what the user does

avatar image Cuttlas-U glen_loganx · Oct 25, 2017 at 11:13 AM 0
Share

hi again; well as it is called its a "system" so i cant give u the code i just can show u some toturials but u have to write it on your own cause its your game;

if u like i can give u some tutorials i think or explain how to make it ? but i dont have to write the code sadly; i saw your massage in gmail by the way;

avatar image glen_loganx Cuttlas-U · Oct 26, 2017 at 06:18 AM 0
Share

could i get the tutorials on it please?

Show more comments
avatar image
0

Answer by x4637x · Oct 26, 2017 at 10:30 AM

I think you will find this useful : NavMesh building components

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

74 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Getting a navmeshagent back on a navmesh. 1 Answer

How do I get agents to avoid each other? 0 Answers

Navmesh y-axis 1 Answer

How to use Unity's pathfinding system without NavMeshAgent controlling my character? 1 Answer

How to prevent NavMeshAgents from colliding when warped to same position? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges