Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Neolink on September 16, 2017, 02:44:44 PM
-
The current Unity Navigation component on github allows for rebuilding the navmesh at runtime, it works fantastic with the example projects and works in my project too if I use the script they provided, the problem is that the script they provided triggers a navmesh rebuild only when "Fire1" is pressed, I want it as an action that I can get my FSM's to trigger when I need it, in my case, it is when a building is created. As far as I can tell there is not a Playmaker action yet supporting any of the new Unity Navigation component features.
I've tried copy and pasting bits of the script into a custom FSM but I just get errors or nothing happens, I don't know how to code at all, so I am not having much luck!
The BuildNavMesh script provided by unity is:
[DefaultExecutionOrder(-100)]
public class NavMeshBaker : MonoBehaviour
{
NavMeshSurface surface;
void Start()
{
surface = GetComponent<NavMeshSurface> ();
surface.BuildNavMesh ();
}
void Update()
{
if (Input.GetButtonDown ("Fire1"))
surface.BuildNavMesh ();
else if (Input.GetButtonDown ("Fire2"))
surface.RemoveData ();
}
}
If anyone could help me turn this into a simple action which just activates the BuildNavMesh and then "finished" the action, it would be of great help!
Thanks!
-
That should do it (see attachment).
I haven't tried it (because I didn't need to work with NavMeshs yet and didn't want to download and setup all the necessary files from that GitHub just to test this action) but it should work.
Just specify the GameObject with the 'Nav Mesh Surface' component and you're good to go.
If there is something not working or if you wan't other behaviour/additional features, just let me know.
-
Thanks a lot, it seems to work just fine :) I'd recommend this to go on the Ecosystem, I am sure many other people would find having a dynamic navmesh useful!
-
Hi,
ok, this is weird, I can't find any documentation on this, which version of Unity are you using?
Bye,
Jean
-
Hi jean,
Thanks for all of your hard work with playmaker! I am using Unity 5.6.3f1.
The documentation and components are here https://github.com/Unity-Technologies/NavMeshComponents .
I don't know why this is not included with Unity, it is so much better than the default Navigation and it has been demo'ed by Unity at many offical gatherings and on official youtube, but it is hidden away on github! I would expect it to be at least on the asset store with the rest of the free official Unity stuff, but it is not.
-
Hi,
Cool, It's incredible how much stuff is going on... How can we keep up with all of this! :)
I'll check with Eric or Djaydino to tackle this runtime navmesh feature and provide maybe a set of actions and proxies to work with this.
Bye,
Jean
-
Sure, I will look into this one and post the results ;D
-
Wahoo! +1 to this ;)