Uh oh!
There was an error while loading. Please reload this page.
Performance improvement for large scenes - #198
Conversation
Now the removal of obstacles and agents when processing the navMeshBuildSource list has improved a lot for scenes with high density of GameObjects
@turadr I have been tested in a large scene and it takes approximately only 8% of the time now |
mattluard
commented
Jan 16, 2021
Thanks for sharing, I've been trying out this optimisation in my game and it's working great. |
Extrys
commented
Jan 17, 2021
I'm glad to hear that! let's see if this gets merged into the official master branch :) |
turadr
commented
Jan 18, 2021
@Extrys Thank you very much for sharing these changes with the community. We are currently not merging any external contributions. Once that will become possible again we will evaluate this PR. |
Nice, thanks for letting me know about that! |
Extrys
commented
Aug 4, 2021
I stronly recommend merging this PR, since it improves a lot the baking time for realtime continuous simulation |
| if (m_IgnoreNavMeshAgent) | ||
| sources.RemoveAll((x) => (x.component != null && x.component.gameObject.GetComponent<NavMeshAgent>() != null)); | ||
| sources.RemoveAll((x) => x.component != null && x.component is NavMeshAgent); |
There was a problem hiding this comment.
This has been made in this way due to Its much more efficient a type check tan getting from the "already obtained component" the component with he typed object, and checking if is not null
So
x.component != null && x.component is NavMeshAgent
Is better than
x.component != null && x.component.gameObject.GetComponent() != null
This even let you use this in an asynchronous way since no unity API is being called
I have this oriented to async building, in my project, and it works fantastic
Is for that the second part of the condition is changed in both lines
So i see like a bad move not merging this, honestly
Nrosa01
commented
Aug 6, 2021
I've tested this changed and now my navmesh builds a lot faster, When are you merging this? |
Extrys
commented
Aug 27, 2021
Thanks for approving |
mattluard
commented
Aug 27, 2021
Haha, I think anyone can (like I just did) go and click Review Changes and 'approve' them, but that's not the same as turadr merging them in. For what it's worth, I'm still using this performance improvements and it's been fine for me. So that's my 'approval', as far as it goes. |
Extrys
commented
Aug 28, 2021
Ahh the. Thanks a lot! Currently this improvement is made with de asynchronous navmesh building in mind I can not post that improvement because for that second part of the improvement you need Cysharp.Unitasks That's where the true improvement appears I use this for my game Wich requires recalculating the navmesh constantly in large scenes |
Uh oh!
There was an error while loading. Please reload this page.
bermudalocket
commented
Nov 30, 2021
Is the UniTask branch available anywhere? |
No, but if you want I can do it if that helps |
dycoon
commented
Oct 1, 2022
Good Fix! |
Nrosa01
commented
Dec 3, 2022
Is this going to be merged? I'm still waiting :( |
psociety
commented
Oct 12, 2024
Hi! At Unity our ego doesn't allow us to merge external improvements nor fixes. |
Now the removal of obstacles and agents when processing the navMeshBuildSource list has improved a lot for scenes with high density of GameObjects