Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Teku-Studios · Mar 20, 2013 at 04:18 PM · 2dcollidermeshnavmeshnavigation

How to generate a NavMesh only with colliders?

Hi,

We are experiencing some trouble with NavMeshes. We are developing a 2D sprite-based sidescrolling game, and we can't generate any NavMesh only with the colliders of the sprites, we have to add physical 3D meshed objecs in order to get the NavMesh created. However, this is absurd since we do not need any 3D modelled object or ground in a sprite game.

Is there any way to achieve this? Thanks.

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

5 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Frallis · Mar 17, 2017 at 10:02 PM

Its possible to keep the mesh renderer and set materials to 0

Comment
Add comment · Show 1 · 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 nicmarxp · Oct 11, 2018 at 08:56 AM 0
Share

Great answer, set $$anonymous$$aterials > Size to 0, and don't just delete the one that exists, or it will be a pink object. :)

avatar image
1

Answer by permanentrecords · Sep 27, 2013 at 06:03 PM

I ran into this issue today and came up with an answer. It works, so I am very happy. I create cubes where I want the navmesh, or add a mesh renderer to the colliders I have and set them to a transparent material so that I can tell when it is on or off. I then threw them all in an empty gameobject just to keep them together, and then baked the navmesh. When that was done, I disabled the mesh renderers - they went away leaving the navmesh - and colliders - intact.

Comment
Add comment · Show 1 · 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 Yanifska_ · Nov 10, 2013 at 06:21 PM 0
Share

So I am not alone experiencing this issue. It is quite annoying, as in my case I need to keep my colliders and my navmesh object separated. And each time I need to make a change to my navmesh I need to turn the mesh renderer on again, it's quite messy in my opinion

avatar image
0

Answer by alior · Mar 06, 2015 at 04:48 PM

You can create this with meshes. You should add the script like the following to the objects that you don't wanna see after game starts:

 class SomeScriptName
 {
 
     void Awake()
     {
         gameObject.SetActive(false);
     }
 
 };

Now you can bake you navMesh. The mesh will not change while the objects are enabled. After game starts your objects dissables and you dont have it on your scene. After you press stop objects will be enabled and you can modify it if you want :) (Another on advice: don't make them fully static. Just mark as walkable with NavMesh window. Disabling static object can cause big overhead)

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
avatar image
0

Answer by baixiaobest · Jul 03, 2016 at 12:41 PM

My way of solving this is instead of setting the object to transparent material, I set it to invisible using custom invisible shader. That way you can enable the mesh renderer and you will not see the object.

 Shader "Custom/Invisible" {
     Properties {
         
     }
     SubShader {
         Tags { "Queue" = "Transparent" } 
         Pass{
             Tags{"LightMode" = "ForwardBase"}
             ZWrite off
             Blend Zero DstAlpha
 
             CGPROGRAM
 
             #pragma vertex vert
             #pragma fragment frag
 
             struct inputVertex{
                 float4 vertex : POSITION;
             };
 
             struct outputVertex{
                 float4 pos : SV_POSITION;
             };
 
             outputVertex vert(inputVertex v){
                 outputVertex o;
                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                 return o;
             }
 
             float4 frag(outputVertex i) : COLOR
             {
                 return float4(0,0,0,0);
             }
 
             ENDCG
         }
 
         Pass{
             Tags{"LightMode" = "ForwardAdd"}
             ZWrite off
 
             CGPROGRAM
 
             #pragma vertex vert
             #pragma fragment frag
 
             struct inputVertex{
                 float4 vertex : POSITION;
             };
 
             struct outputVertex{
                 float4 pos : SV_POSITION;
             };
 
             outputVertex vert(inputVertex v){
                 outputVertex o;
                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                 return o;
             }
 
             float4 frag(outputVertex i) : COLOR
             {
                 return float4(0,0,0,0);
             }
 
 
             ENDCG
         }
     }
 
 
     FallBack "Diffuse"
 }
 

You need to create a new material with this shader, then attach the material to the object. Then, you can bake this invisible object into navmesh.

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
avatar image
0

Answer by LeopardX · Jun 02, 2021 at 02:03 AM

Keep the mesh render on, and just give the object a trasparent material set to fade.

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

17 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

Related Questions

NavMeshAgent collision not working with player 2 Answers

Mesh collider cost 1 Answer

Turn an objects mesh renderer on upon collision. 1 Answer

How to create a spherical navigation? 1 Answer

I have used navmesh plus multiple times, can't figure out why it isn't working in this project 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