What is it?
It’s an automated, very simple path finding package for Unity. It’s based on A* and written in UnityScript and C#. I am doing this in tandem with our Deus Ex themed game The Vongott Chronicles.
How to use it?
Refer to the sample project for a demonstration. You can select the map type in the “Scanner” object, and then activate the corresponding object (NavMeshTest, WayPointTest or GridTest).
If you want to enable multi-threading support, you need to get the Loom script by our lord and saviour whydoidoit, and uncomment the lines in OPPathFinder.js
WARNING!
For reasons unbeknownst to me, when you press “Play” and select an object with the OPPathFinder component on it, and the Unity Inspector is visible, there is a huge memory leak in Unity, causing the whole environment to come to a crawl. Select any other object in the scene (or unfocus/disable the inspector temporarily) and it’s fine.
How to get it?
Get the latest package here
GitHub page here
Notes
While it has seen a fair few improvements since its conception, this plugin is not fully optimised. It will need some more work to compete with the fancy, overpriced frameworks on the asset store right now, but it can get there. I’d be very happy to have someone help me improve this and contribute more to the all too small open source development space in this community.
I just unzipped the C# version in my unity 3.5 project (in a folder called OpenPath), and unity says Assets/OpenPath/OPMap.cs(79,45): error CS1501: No overload for method FindObjectsOfType' takes 0’ arguments
and several similar messages. I replaced these occurrences with GameObject.FindObjectsOfType(typeof(OPWayPoint)) as OPWayPoint[ ]
and the errors disappear.
There is already a C# version on the Github page, even though it’s not really needed, as it’s just a matter of where to place the scripts. There is a full explanation in the Unity docs about compile order. I will arrange this differently in a future version to make it easier.
But I have a little problem with using this algorithm.
Everytime I instantiate prefab including map object, scanner, and an pathfinding object having oppathfinder script in different four object’s(e.g obj1,obj2,obj3,obj4) script (obj 1~4’s scripts are same thing. only different thing is obj’s transform.), pathfinding only works when obj1 instantiates the prefab.