Navmesh Add doesn't seem to work across multiple Recast Graphs?

OK. I got rid of the errors for the most part by turning off the RVOSimulator (I need to use this for the game, is this not supported anymore?), though some of them pop up when I stop running, seems to be the same as before.

C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs(46,7): Burst error BC1022: Accessing a managed array is not supported

 at Pathfinding.RVO.RVOQuadtreeBurst..cctor() (at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:46)
 at Pathfinding.RVO.RVOQuadtreeBurst.QueryRec(Pathfinding.RVO.RVOQuadtreeBurst* this, ref Pathfinding.RVO.RVOQuadtreeBurst.QuadtreeQuery query, int treeNodeIndex, Unity.Mathematics.float3 nodeMin, Unity.Mathematics.float3 nodeMax, ref float maxRadius) (at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:368)


While compiling job: System.Void Pathfinding.Jobs.JobParallelForBatchedExtensions/ParallelForBatchJobStruct`1<Pathfinding.RVO.Sampled.JobRVOCalculateNeighbours`1<Pathfinding.RVO.XYMovementPlane>>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:line 46

C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs(46,7): Burst error BC1360: A static constructor on type `Pathfinding.RVO.RVOQuadtreeBurst` is mixing managed and unmanaged code which is not supported. In order to solve this, please move the managed code or unmanaged code to a different class/struct

 at Pathfinding.RVO.RVOQuadtreeBurst..cctor() (at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:46)
 at Pathfinding.RVO.RVOQuadtreeBurst.QueryRec(Pathfinding.RVO.RVOQuadtreeBurst* this, ref Pathfinding.RVO.RVOQuadtreeBurst.QuadtreeQuery query, int treeNodeIndex, Unity.Mathematics.float3 nodeMin, Unity.Mathematics.float3 nodeMax, ref float maxRadius) (at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:368)


While compiling job: System.Void Pathfinding.Jobs.JobParallelForBatchedExtensions/ParallelForBatchJobStruct`1<Pathfinding.RVO.Sampled.JobRVOCalculateNeighbours`1<Pathfinding.RVO.XYMovementPlane>>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
at C:\Users\Solom\Documents\RITUAL\Library\PackageCache\com.arongranberg.astar@4.3.53\Core\RVO\RVOQuadtreeBurst.cs:line 46

This is the error I get now. I don’t understand, I need to scan the graph?

Exception: Cannot Apply NavmeshPrefab to a graph which has not been scanned yet
Pathfinding.NavmeshPrefab.Apply (Pathfinding.RecastGraph graph) (at Library/PackageCache/com.arongranberg.astar@4.3.53/Core/Misc/NavmeshPrefab.cs:278)
Pathfinding.NavmeshPrefab.Start () (at Library/PackageCache/com.arongranberg.astar@4.3.53/Core/Misc/NavmeshPrefab.cs:210)

I thought this already happens when I press scan on the prefab?

EDIT

I tried scanning the RecastGraph itself just to see if anything would happen, no dice.
I tried putting the bounds and center directly on the prefab and scanning it that way, pressed play, same error.

This is what my RecastGraph looks like, worked fine for the actual prefab scanning, perfect navmesh.

I was looking at the exact code and see that it expects the graph to already have tiles:

if (graph.GetTiles() == null) throw new System.Exception("Cannot Apply NavmeshPrefab to a graph which has not been scanned yet");

It is expecting the graph to have tiles clearly, and I’m sure you’re aware of this.

I just don’t see anything in the documentation about how to set up the RecastGraph so it already has tiles loaded… maybe some setting?

Stuck here for sure… also the RVO stuff being broken is not great, don’t know what to do there.

EDIT

Another peculiar thing.

If I don’t use the NavmeshPrefab, remove that components.
Then align the RecastGraph to the right place and scan just as it normally does.
The scan looks identical now, but if I move the prefab, the navmesh stays put, which doesn’t happen with the NavmeshPrefab (thankfully!).

Now as soon as I press play, the navmesh disappears. N if I close playmode, the navmesh is seemingly still gone?

I opened the first RecastGraph example that you had just to see if it had anything to do with my scene and noticed that it also doesn’t seem to show the navmesh, BUT! if i press play, it shows up.

If I click scan in that scene, the navmesh shows up properly, and now when I press play, it still is there… but as soon as I turn unity off, that navmesh disappears again. I have to rescan to get it to show up…
I don’t know what’s going on there at all, and don’t understand why the functioning is seemingly even worse in my main scene that I’ve been testing in.

Hi

Sorry, yes, it looks like I specified the wrong burst dependency.
I don’t have time right now to push another update with fixes, but hopefully I can get to it later today.

Is it possible to just tell me what version of burst is supposed to be here? I may be able to update it properly.

But yeah, idk what’s going on in terms of the RecastGraph, and if it’s affected by the dependency issue.

1.7.2, I think. But I didn’t have time to investigate it thoroughly.

That worked.

No more burst errors.

I also fixed the other issue and now the chunks are working properly (for some reason had to delete the old Pathfinder and make a new one?).

That being said that little issue with the graph disappearing in the editor is still there.

You can try reproducing it like this:

  1. Go to the example scene for RecastGraph that you provide (Example3)
  2. Notice how there isn’t a RecastGraph rendered.
  3. Press Scan to render it out again
  4. Press Play, it should still be there (also if you press play on step 2, u should see it appear).
  5. Stop playing, you should notice it disappear, even tho u scanned it already.

This doesn’t seem to break functionality, but there maybe something here that was causing me issues when I tried to use the NavmeshPrefab system after having upgraded, with old Pathfinders in the game.

Just FYI, I even duplicated my pathfinder, and disabled the old one, n it was still giving out that bug I mentioned before with the RecastGraph having 0 tiles, and there being no RecastGraph in the scene even tho I scanned it.

I had to create an entirely new gameobject, put the new pathfinder on it, then it worked.

That being said, this is a dream come true, thank you so much for pushing ahead on this feature, can finally start integrating it into the game I think.

Oh one more thing… this was tripping me up pretty bad.

There is an issue with the “Snap position to nearest tile” button. It seems to snap me to the wrong place based on the settings I have:

image

This should make it so the tile size is 0.02 * 100 = 2 right.
Well when you click that button, it seems to snap me to some other value? I honestly don’t know what it is… Also if you click that and you run the game, it’ll actually create a visible offset in the navmesh and misalign things.

However, if I follow my own logic and make sure the position is a multiple of 2, everything works right, no more weird offset.

Also I clearly am not making my bounds a multiple of 2.6 as it says I should:
image
Notice how it doesn’t complain when I make it 62?
image

Definitely not divisible by 2.6.

I was trying to find the code associated with this and validate how it’s doing the calculation, but I think there’s something wrong.

That “Snap to position to nearest tile” should not be shifting it away like this:

Before Clicking (everything aligned and working properly if I run at this point):
image
image
After Clicking (things shifted improperly):
image
image

Not even sure what those snapped values are. It’s not even divisible by 2.6 as the bounds is suggesting.

One last piece of feedback I have about this, since you asked about workflow and such… I was wondering what is causing the noticeable freeze. I think my implementation did not have such a long freeze, this does when pressing play. I’m not sure what’s going on here, if it’s a matter of the file being read or what. I haven’t profiled it yet but I can.

This PC is considered a “UFO” on all fronts (Userbenchmark), so if it’s freezing here, the people playing my game are gonna be frozen for even longer probably, and since it’s VR, that is not a great thing to have. Obviously can put this behind a loading screen of sorts (though, if Unity is outright frozen it’ll boot my player out of the game into the SteamVR menu as it waits, it looks like the app is hanging, hence why I’m a bit worried about this), but if there is something you can do about that, it would be useful. I think it’s just the sheer amount of tiles given the resolution… maybe there is an asynchronous way to fill the tiles as to not cause a freeze?

This is just a thought about performance, it is important for me just given the nature of my game, I don’t want to have people sitting in a frozen loading screen in VR, it would be quite bad user experience wise.

I don’t want to detract from how useful this is, I’ll be able to keep pushing ahead and make a good demo of my game and for that I owe you everything, but this is definitely going to be on my radar next for crucial improvements.

EDIT

I’m actually unsure about the performance issues. Very exhausted at this point and need to sleep, there maybe something else going on, it looks like there is a decent performance hit on the profiler from loading and clearing tiles but I don’t know for sure. Let me know if you notice anything similar.

Thanks again for all the support, will be leaving a good review on the asset store for sure :+1:

This is by design. The whole scanned graph data is too much data to persist in Unity scene files (the Unity editor slows down to a crawl if I try), so only graph settings are persisted. This means that when going from editor → game, or vice versa, the graph data is cleared because Unity reloads the whole C# domain. You can make the graph show up again by scanning the graph (button or ctrl-alt-s).
The NavmeshPrefab can persist the scanned navmesh because it is actually backed by a file.

Hmmm… yeah, something’s off here, I’ll investigate. Thanks for reporting it!

I haven’t seen any big impact of loading and clearing tiles. Maybe it’s from the recast graph being scanned when the game starts? (see also A* Inspector → Settings → Scan On Awake).

:blush:

This is not a problem, btw. My compiles fine with any version of mathematics above or equal to 1.1.0. The package manifest only specifies the lowest required version. Unity will resolve the dependencies so that all minimum versions checks are satisfied.

1 Like

I’ve uploaded a new version (4.3.54) which fixes all issues you mentioned, I hope. Let me know if it works better for you :slight_smile:

1 Like

Hmm yeah I think it is from this.

However, if I don’t have that option on, then the NavmeshPrefab fails in that same way… makes me realize why it was breaking before and why I had to make a totally new Pathfinder gameobject.

Exception: Cannot Apply NavmeshPrefab to a graph which has not been scanned yet
Pathfinding.NavmeshPrefab.Apply (Pathfinding.RecastGraph graph) (at Library/PackageCache/com.arongranberg.astar@4.3.53/Core/Misc/NavmeshPrefab.cs:278)
Pathfinding.NavmeshPrefab.Start () (at Library/PackageCache/com.arongranberg.astar@4.3.53/Core/Misc/NavmeshPrefab.cs:210)

Is it absolutely necessary to scan? I think the reason my solution didn’t lag is because I just set the tile array size manually instead of scanning on awake.

The scan is causing very large lag spike at the beginning and slowing down development by like 20-30 seconds every run… really starts adding up.

If your solution works anything close to mine, it should be possible to get away with not scanning in this situation which would go along way to removing the freezing.

Oh didn’t see this. I’ll update and let you know, thanks!

OK. Updated it.

No more lag spike at the beginning after removing the “Scan on Awake” option & no error as previously reported… Everything loads fine.

The snap position thing still seems to be acting the same as before, but I do see that if I changed the bounds, the message updates to reflect the actual reflect graphs setting in the scene (saying 2.0 instead of 2.6).

Not sure why the snapping is messed up though.

I checked the Pathfinder component to see if had any offset in it’s transform, nope, checked the center within that to see if there’s any offset there, nada.

I don’t see what it’s snapping relative to, 100 turns into 100.48… clearly not divisible by 2.0 still.

Anyways the really important bits are out of the way, I can deal with snapping on my own, just letting you know that I’m noticing it’s acting funky. I tried using that function in empty scenes to double check it’s acting weird, and it definitely does.

Just try setting the settings so the tile size becomes 2.0 and you should be able to reproduce.

One more thing.

I use NodeLink2 to make it possible for my enemies to jump around the vertically oriented maps.

If it’s not too much to ask/not too hard, is it possible to also have a “PointGraphPrefab” or something?
If it is a bit much right now to deal with it, or too difficult, I am going to try to make a component like that, scan it, cache it, transform it properly… I mean I’ve already pretty much made it, so it shouldn’t be too difficult to do it again. It’ll be one RecastGraphs, and many PointGraphs in the end.

I’m hoping having multiple point graphs accessing a single combined navmesh would be OK? idk.

Let me know what you think.

EDIT

Spoke too soon, this may be a non issue… Seems scanning actually saves that data too? Double checking in my generation now.

Yep works perfectly, thanks again.

Little gif of everything in action.

gif

  1. NavmeshPrefabs having loaded properly and without lag (including PointGraph data!)
  2. Navmesh Add to bridge gaps so that they can go through doors to other chunks
  3. Enemies using RVOController for steering, and being able to jump across the various nodelinks to follow the player vertically.

That about does it for now. I integrated it into my dungeon generation and everything is working well… Seems like performance is good for now too. That snapping button thing is not a huge issue for me.

:tada: :partying_face: :tada:

1 Like

Hey! I just wanted to check in and see if things are still working well? Are there any issues with the workflow you have found? :slight_smile:

1 Like

Everything seems to be fine. I’d say it’s fairly stable for what it does, haven’t had issues. Am able to do pretty much every thing I wanted to, including nodelinks.

Thanks so much for the effort, so far it’s perfect though I will say I have not been pushing my luck since this haha.

1 Like

Thought I replied to this