Search Unity

Unable to Bake a NavMesh

Discussion in 'Editor & General Support' started by tjjos, Oct 16, 2012.

Thread Status:
Not open for further replies.
  1. tjjos

    tjjos

    Joined:
    Aug 24, 2012
    Posts:
    3
    Hi all,

    I'm trying to bake navigation info onto a simple mesh following the instructions outlined here. The mesh is marked as navigation static. I then go to the Navigation Window and click on the Bake button, but nothing happens. If I go to the scene, I find a file called NavMesh.asset with some data related to the navigation, but the mesh is not colored blue (as it usually is when navigation is successfully baked). If I create an Agent with this NavMesh, when I press play I get an error indicating the NavMesh is not valid.

    I've tried several combinations and approaches but I always get the same result. What am I doing wrong? Can someone please help me? I've been stuck with this for a couple of days and it's driving me crazy :x

    Thanks in advance,

    Jos

    P.S. It's worth noting that nothing is displayed on the Editor and no log entry is generated when I click the bake button. It only creates the NavMesh.asset with (apparently) invalid data.
     
    Hincuu likes this.
  2. foxter888

    foxter888

    Joined:
    May 3, 2010
    Posts:
    530
    is your unity the pro version?
     
  3. tjjos

    tjjos

    Joined:
    Aug 24, 2012
    Posts:
    3
    Yes, we have Unity Pro.

    The main problem is that the NavMesh baking tool is fairly inconsistent. Sometimes it works, then you change the most minimal thing (like moving a vertex) and the baking doesn't work anymore.

    The thing that bothers me the most is that I don't get any feedback whatsoever about what am I doing wrong.

    Any ideas?
     
  4. runner

    runner

    Joined:
    Jul 10, 2010
    Posts:
    865
    having trouble?

    create a separate layer
    assign mesh's to this layer

    in the inspector check to make sure the mesh [objects] are assigned and the layer is also the correct one.

    Bake!

    after this is done baking you should see a nice blue mesh, but if you don't assign the layer to the main camera you wont visually see it otherwise.

    Note: normally i believe Navmesh bakes to the default layer so you should have seen the blue navmesh
     
    Last edited: Oct 17, 2012
  5. CreativeChris

    CreativeChris

    Unity Technologies

    Joined:
    Jun 7, 2010
    Posts:
    457
    Hi @tjjos,

    "but the mesh is not colored blue" - What colour is it?

    In relation to an invalid Nav Mesh error, can you post some screenshots so we can see after the bake and also see the nav mesh layer /s? if the agent doesn't match that layer it cannot attach to it.

    Thanks,
    Chris
     
  6. tjjos

    tjjos

    Joined:
    Aug 24, 2012
    Posts:
    3
    First of all, thanks for answering guys.

    After some more experimentation, I found out what the problem was (and it's not related to the layers, but thanks for the suggestion either way):

    I turns out that my model (imported from FBX file) was too small, because by default unity scales them by 0.01. So when I wanted to bake a NavMesh using this model, the process was working correctly (supposedly), but (and it's a big but - no pun intended), doesn't show the blue mesh because it was basically infinitesimal (to small to see). To explain a little bit further, the default (an even the minimum) values permitted by the baking were many times greater than the actual model dimensions, so when the baking process tried to calculate where the NavMesh would go, there was not "enough room" for it to fit the most minimal unit of a NavMesh. Make sense?

    So, to fix this issue, I just scaled my model until the baking process was able to calculate enough data for it to show the "long sought" blue mesh of success :p

    Either way, it would be nice if Unity would issue a warning like "Unable to bake mesh because it is too small!!!", or something like that so that you would not have to spend days trying to figure out what was wrong using your 6th sense, or spider sense or experienced-programmer sense, or whatever sense you might have developed for this kinds of situations.

    Anyways, thanks again for your help.

    Jos
     
    Scalene_Games and Hincuu like this.
  7. orphicsage

    orphicsage

    Joined:
    Jul 10, 2013
    Posts:
    5
    Although re-sizing the model via the import settings works. Simply adjust the radius in the bake settings. That should fix the problem :)
     
    Amal-Sh likes this.
  8. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    60
    I wrestled all morning with this only to have the same problem. No warnings, no indication of what the problem was.
    Thank you so much for this post.
     
  9. Bitpocketer

    Bitpocketer

    Joined:
    Jul 20, 2014
    Posts:
    4
    Damn , i had been stuck with this problem for past few hours untill i came across this post. Thanks it worked, but what i'm trying to achieve is animate the light through navemesh , say like i have an octupus , and the light has to illuminate all its legs being navemesh agent, and the octupus is small in size. what would be the good approach to do this?
     
  10. Whiteleaf

    Whiteleaf

    Joined:
    Jul 1, 2014
    Posts:
    728
    Sorry for reviving a dead thread, but I came across this as I was having issues with the navmesh baking.

    For me, all of my object's scale was: 1, 1, 1. and in the NavMesh baking options, the height was set to 2, thus leading to it not baking as it couldn't. Hope this helps someone.
     
  11. LukeLitman

    LukeLitman

    Joined:
    Jun 9, 2015
    Posts:
    6
    Ran into a similar issue, I had forgotten to mark the meshes as static... Hope that helps.
     
  12. seanke

    seanke

    Joined:
    Aug 5, 2018
    Posts:
    1
    This was my issue! Thanks!
     
  13. CompediaDev

    CompediaDev

    Joined:
    Nov 18, 2014
    Posts:
    4
    Just throwing out here that I had about the same issue, and mine was solved by setting the Min Region Area in the advanced baking settings to a lower value, since the areas I was trying to bake were very small.
     
  14. Pandazole

    Pandazole

    Joined:
    Sep 23, 2019
    Posts:
    28
    I get the issue and didn't work any of above answers, and figure out the solution is unbelievably stupid. If you baked while turned off the Gizoms, you will not see the blue area, so just turn on the Gizmos. God I'm feel so stupid now lol :).
    Screenshot (234)_LI.jpg
     
  15. darklord849

    darklord849

    Joined:
    Jan 11, 2018
    Posts:
    6
    Thanks a ton, if I would have read this before doing this by myself , i might xD
     
  16. unity_ebrUqR-c_Iskaw

    unity_ebrUqR-c_Iskaw

    Joined:
    Jan 17, 2020
    Posts:
    1
    this was my issue as well . thanks
     
  17. wellingtonipf

    wellingtonipf

    Joined:
    Mar 15, 2018
    Posts:
    2
    You save my day HAHAHA!
     
  18. Mr_StoneMan

    Mr_StoneMan

    Joined:
    Sep 20, 2019
    Posts:
    1
    Lol... a long time later and this just saved my life. thanks friend
     
  19. chrisbrophyuk

    chrisbrophyuk

    Joined:
    Apr 4, 2021
    Posts:
    1

    OMG fiddling around for hours then I see this lol
    thanks....this worked :)
     
  20. metroarik

    metroarik

    Joined:
    Nov 9, 2019
    Posts:
    1
    Oh man ty ty lol

    I'm trying this I'm trying that Gizmo lol thank's A LOT :}
     
  21. firstBamos

    firstBamos

    Joined:
    Aug 25, 2021
    Posts:
    1
    I have an error with baking NavMesh on android.
    I'm creating a game using NavMesh. In the editor, after overwriting NavMesh, everything works well. If I run the game on Android, the npcs behave as they should UNTIL a new bake during the game. Then they just stop and don't run anywhere.
    I have been trying to solve the problem for 2 days, nothing helps. Maybe someone has faced such a problem?
     
  22. sarwararnob999

    sarwararnob999

    Joined:
    Nov 19, 2020
    Posts:
    2
    Glad I read the whole thread, same issue :3
     
  23. ChickenCrimpyKade

    ChickenCrimpyKade

    Joined:
    Aug 22, 2021
    Posts:
    1
    I'm trying to bake, but when I click bake nothing happens. No blue outline or anything like that.
    Some help would be greatly appreciated
     
  24. Hacktivist2007

    Hacktivist2007

    Joined:
    Dec 29, 2021
    Posts:
    25
    I love you
     
  25. Warrior-E_X_E

    Warrior-E_X_E

    Joined:
    May 1, 2022
    Posts:
    2
    sorry for pulling this thread out of its grave but just realized i didnt have gizmos on until i saw pandazol's image
     
  26. benjaminmit

    benjaminmit

    Joined:
    Oct 3, 2022
    Posts:
    1
    i still have the issue
     
  27. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Please don't necro-post to 10-year-old threads with incomplete vague comments.

    Instead, learn how to communicate technical problems effectively.

    Start your own thread, and follow this guide:

    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

    If you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/

    If you have no idea what is going on, start here:

    You must find a way to get the information you need in order to reason about what the problem is.

    Once you understand what the problem is, you may begin to reason about a solution to the problem.

    What is often happening in these cases is one of the following:

    - the code you think is executing is not actually executing at all
    - the code is executing far EARLIER or LATER than you think
    - the code is executing far LESS OFTEN than you think
    - the code is executing far MORE OFTEN than you think
    - the code is executing on another GameObject than you think it is
    - you're getting an error or warning and you haven't noticed it in the console window

    To help gain more insight into your problem, I recommend liberally sprinkling
    Debug.Log()
    statements through your code to display information in realtime.

    Doing this should help you answer these types of questions:

    - is this code even running? which parts are running? how often does it run? what order does it run in?
    - what are the values of the variables involved? Are they initialized? Are the values reasonable?
    - are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)

    Knowing this information will help you reason about the behavior you are seeing.

    You can also supply a second argument to Debug.Log() and when you click the message, it will highlight the object in scene, such as
    Debug.Log("Problem!",this);


    If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.

    You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.

    You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.

    You could also just display various important quantities in UI Text elements to watch them change as you play the game.

    If you are running a mobile device you can also view the console output. Google for how on your particular mobile target, such as this answer or iOS: https://forum.unity.com/threads/how-to-capturing-device-logs-on-ios.529920/ or this answer for Android: https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/

    Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.

    Here's an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:

    https://forum.unity.com/threads/coroutine-missing-hint-and-error.1103197/#post-7100494

    When in doubt, print it out!(tm)

    Note: the
    print()
    function is an alias for Debug.Log() provided by the MonoBehaviour class.
     
Thread Status:
Not open for further replies.