Apr
21
2017

Using SharpNav with Unity

Noticed this SharpNav repository (Advanced Pathfinding for C#) at https://github.com/Robmaister/SharpNav

Since new unity versions support .NET 4.6, this should work in unity too,
the sample script below runs, but not sure how to access the navmesh or navigation features..

Instructions:
– Download SharpNav https://github.com/Robmaister/SharpNav
– Open SharpNav-master\SharpNav-master\Source\SharpNav.sln in VisualStudio
– Right click SharpNav on the Solution Explorer, select Build *Note: this compiles with 4.5.1
– Copy ‘SharpNav.DLL ‘, ‘Newtonsoft.Json.dll’ and ‘YamlDotNet.dll’ files from SharpNav-master\SharpNav-master\Binaries\SharpNav\Debug\ folder into unity project, Plugins/ – folder
– In Unity project, select .NET 4.6 in the player settings *Need to restart unity after this
– Download example mesh and add to scene, from: https://github.com/Robmaister/SharpNav/blob/96ddd939f292a4f4e76b460c1f783cdf1e9bcf41/Source/SharpNav.Examples/nav_test.obj
– Attach script below into empty gameobject
– Drag example mesh into meshFilter field in the empty gameobject script
– Hit Play! (nothing really happens.. would have to access the navmesh, but you are on your own now..*please post comment if you get it working, i’d like to know also : )

**Note: here is older unity project for Recast/Detour library: https://github.com/unitycoder/rcdtcs

Source:


Leave a comment

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.