playMaker

Author Topic: Making a BuildNavMesh custom action.  (Read 228 times)

Neolink

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Making a BuildNavMesh custom action.
« on: September 16, 2017, 11:44:44 AM »
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:

Code: [Select]
[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!

Deek

  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #1 on: September 16, 2017, 01:47:32 PM »
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.

Neolink

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #2 on: September 16, 2017, 02:19:07 PM »
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!


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #3 on: September 17, 2017, 11:44:25 PM »
Hi,

 ok, this is weird, I can't find any documentation on this, which version of Unity are you using?

Bye,

 Jean

Neolink

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #4 on: September 18, 2017, 01:48:45 AM »
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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #5 on: September 18, 2017, 11:40:40 PM »
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

tcmeric

  • Sr. Member
  • ****
  • Posts: 480
    • View Profile
Re: Making a BuildNavMesh custom action.
« Reply #6 on: September 19, 2017, 11:33:47 PM »
Sure, I will look into this one and post the results  ;D

craigz

  • Junior Playmaker
  • **
  • Posts: 68
    • View Profile
    • Haven Made
Re: Making a BuildNavMesh custom action.
« Reply #7 on: September 20, 2017, 11:13:22 AM »
Wahoo! +1 to this ;)