Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

2D NavMesh Plus - Components and Extensions System

Discussion in '2D' started by vhman, May 11, 2022.

  1. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    15
    Mate! It started to work while i started recording a video for you about what i was doing. Heh. I hope you check the thread later because i'm going to make a working project tomorrow and see if it works totally as wished. Thank you :)
     
  2. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    15
    Now it did it again, as soon as i add the folder in my unity Assets, it informs:
    upload_2023-2-7_17-47-40.png upload_2023-2-7_17-47-40.png


    Unity version: 2022.2.4f1
     
  3. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    Got it. That is just a warning. I'll fix it in few days
     
  4. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    15
    Thanks :) I'll write if anything new appears. Your effort is helping me and many people alot!
     
  5. cyberdrunkdev

    cyberdrunkdev

    Joined:
    Dec 6, 2022
    Posts:
    15
    Is there any way to get the Z-axis of the agent rotate while moving? Would love to get the sprite rotate like a wheel, but i find it impossible.:D
     
  6. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    cyberdrunkdev likes this.
  7. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    Am I missing some thing or Navigation window was moved to Navigation.AI package in
    Unity 2022.2? So Navigation.AI is required in every project?

    Right now NavMeshPlus should work Navigation.AI just fine, but it inconvenient to have duplicated components.
    Am thinking about new NavMesh Plus redesign. If anyone have a feedback how to make NvMeshPlus better please leave a comment.
     
  8. smarart

    smarart

    Joined:
    Feb 16, 2023
    Posts:
    4
    Is it possible that there's a conflict between the NavMeshPlus package and the default NavMeshComponents package in Unity 2022.2.5.

    The navmesh component shows as: "Navigation Surface", not NavMeshSurface.
    And my C# can't find either of those NavigationSurface or NavMeshSurface.
    i'm using #UnityEngine.AI;

    I'm trying to bake a mesh on runtime, but this doesnt work:

    public NavigationSurface a;
    or
    public NavMeshSurface b;



    Another question:
    I have Walls, and i would need to make the walls tinyer, but they have this one centimeter "frame or spacing" around the wall. How to make it thinner? Didn't help that i lowered the Agent's radius.

    Here's an example in the image. It leaves some kinds of spaces around the baked area:
    https://pasteboard.co/0Le2nYu9NvmM.png

     
    Last edited: Feb 22, 2023
  9. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    cecilcruxis and smarart like this.
  10. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    Hello All,

    Quick update:
    - Fixed icons
    - Fixed memory leak (meshes not destroyed)
    - Add tooltips
     
    cecilcruxis likes this.
  11. Cevia

    Cevia

    Joined:
    Jun 7, 2016
    Posts:
    3
    Is there any way to create agents that have an irregular shape? I have a unit that is significantly wider than it is tall. What I'd want is an agent type that has more clearance on the x-dimension than the y-dimension, but it appears that the "height" variable does nothing and "radius" is used for determining both. This is, oddly enough, completely different than the way Obstacle Avoidance in NavMeshAgent works, where the y-dimension is governed by the "height" variable.
     
  12. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    @Cevia

    I think there is no way to define agent shape with Unity NavMesh.AI. Take a look at A* Pathfinding, maybe there something for you.
     
    Cevia likes this.
  13. SlapstickMojo

    SlapstickMojo

    Joined:
    Aug 9, 2013
    Posts:
    1
    Ok, stupid question -- I downloaded and copied navmeshplus into my assets folder, but no matter what I do, navmeshmodifier and navmeshsurface2d never appear in my list of components.Is there something I need to hit to make it recognize the scripts?
     
  14. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
  15. Ikuti

    Ikuti

    Joined:
    Oct 24, 2016
    Posts:
    5
    Hi, great addon! (I'm a bit suprised Unity doesn't have good 2D navmesh solution out of the box though...)
    I was wondering if you plan to create extension for nav mesh obstacle for 2D carving with the sprite renderer instead of what it is currently, with 2 possible 3D shapes. It would be a godsend for any dynamic objects that move constantly or move and than stop.
    Either way, thank you for making this addon!
     
  16. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    @Ikuti

    There will be no Obstacle support, as they ignore layers. Carving will be done with navmesh update. Right now it somewhat working and will be improved, maybe I'll introduce some wrappers.

    You can already check https://github.com/h8man/RedHotSweetPepper/tree/master/Assets/Scenes/SampleSceneRuntime.meta

    You can use update every frame, every few frames, use cache or supply your sources.

    Also I need to check this stuff public bool preserveTilesOutsideBounds { get { return m_PreserveTilesOutsideBounds != 0; } set { m_PreserveTilesOutsideBounds = value ? 1 : 0; } }
     
  17. SpicyDinosaur

    SpicyDinosaur

    Joined:
    Oct 25, 2019
    Posts:
    3
    I am having problems with The package. I'm sort of feeling around blind. I originally couldn't get the nav mesh to even show up on my screen, then the programmer I'm working with was able to get it to work and I was briefly able to get it to work and now it just... doesn't.I'm trying to follow the tutorial but what I am seeing from my end is not the same, even the actions like dragging a sprite onto the gameobject and it creating the sprite renderer component isn't a thing.

    By saying it showed up I mean I could see a blue grid of sorts. The green square in the images had a border that was the white of the "floor" I have under the layout gameobject. Basically the cut out part of the navmesh.

    The only change I made between working and not working was to turn the NavMesh gameobject into a prefab. Then I carried it over to a different scene, where it didn't work. When I went back to the test scene it no longer worked. This might be because baking it altered the prefab but I didn't revert or apply any changes to the gameobject in the hierarchy either in the test scene or the scene I tried to implement the navmesh to that had other things on it.

    I've attempted to recreate the navmesh from scratch in the test scene, along with recreating that green square since it has the nav mesh obstacle component on it. But nothing makes it work.

    The Unity version I'm using is the one that the navmesh was up to date as of, namely 2021.3.8f1. I can't remember where I found that information off the top of my head, though. I think from when I downloaded the sample project. Previously, my project was a bit behind that, but there have been no issue as far as my project working otherwise so far.

    The package itself is up to date.

    I'm not familiar with using the Nav Mesh outside of this package as this is my first attempt at using the navmesh at all.

    The attached images show what my navmesh gameobject is set up like as well as the green obstacle.


     
  18. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    Hello @SpicyDinosaur
    Tutorial and documentation cannot keep up with updates(
    I would recommend to get familiar with the package with https://github.com/h8man/RedHotSweetPepper

    From screens I see that you have only 1 source marked for a navigation, but its 'Obstacle', I think you missed 'Navigation Modifier' components
     
  19. SteveKouts

    SteveKouts

    Joined:
    Aug 23, 2012
    Posts:
    64
    Package won't compile. Im using Unity 2019.2.17f

    Compile timer just keeps spinning.

    ArgumentException: Not Found
    UnityEditor.Scripting.ScriptCompilation.SemVersionRanges.GetExpression (System.String expression) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/SemVersionRanges.cs:35)
    UnityEditor.Scripting.ScriptCompilation.SemVersionRangesFactory.GetExpression (System.String expression) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/SemVersionRangesFactory.cs:16)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.SetTargetAssemblyDefines (UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly targetAssembly, UnityEditor.Scripting.ScriptCompilation.SemVersionRangesFactory semVersionRangesFactory, System.Collections.Generic.Dictionary`2[TKey,TValue] assetPathVersionMetaDatas, System.String[] editorOnlyCompatibleDefines, System.String[] playerAssembliesDefines, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1953)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.UpdateAllTargetAssemblyDefines (System.Collections.Generic.IDictionary`2[TKey,TValue] customScriptAssemblies, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly[] predefinedTargetAssemblies, System.Collections.Generic.Dictionary`2[TKey,TValue] assetPathVersionMetaDatas, UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1901)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetTargetAssembliesWithScripts (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1770)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.DeleteUnusedAssemblies (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings settings) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1101)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.ScriptAssemblySettings scriptAssemblySettings, System.String tempBuildDirectory, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.EditorBuildRules+TargetAssembly[]& notCompiledTargetAssemblies, System.String[]& notCompiledScripts) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1315)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CompileScripts (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1275)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilation.TickCompilationPipeline (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.BuildTargetGroup platformGroup, UnityEditor.BuildTarget platform) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilation.cs:1718)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface+<TickCompilationPipeline>c__AnonStorey5.<>m__0 () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:371)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface.EmitExceptionAsError[T] (System.Func`1[TResult] func, T returnValue) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:97)
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/EditorCompilationInterface.cs:371)
     
  20. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    @SteveKouts,

    Hello, I didn't test Unity 2019.2.17f, Ill check.
     
    SteveKouts likes this.
  21. SteveKouts

    SteveKouts

    Joined:
    Aug 23, 2012
    Posts:
    64
    Thank you!
     
  22. SpicyDinosaur

    SpicyDinosaur

    Joined:
    Oct 25, 2019
    Posts:
    3

    I'm doing the regular navmesh tutorial during lessons I have with the person who taught me c# so hopefully that will help me better understand things, but for now should I have both obstacle AND navigation modifier or just the latter? I'll reference Sweet Hot Pepper as soon as I am about to start, as well. Last time I checked it I couldn't see what I wasn't doing but maybe I'll notice something this time.

    Right now, with both obstacle and modifier on I'm not seeing a difference.

    EDIT: I'm dense, I had turned widgets off to be able to better see any changes, but that turned off the visual for the navmesh itself!
     
    Last edited: Apr 23, 2023
  23. vhman

    vhman

    Joined:
    Aug 13, 2018
    Posts:
    316
    Hi all.

    Just wanted to leave a comment that wiki is open for update and edit. I have little time to update documentation after every changes. While lately a see many PR on code, there no major update on wiki. We can do one page at a time)
     
    MaDDoX likes this.