playMaker

Author Topic: BuildNavMesh  (Read 4553 times)

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
BuildNavMesh
« on: July 27, 2016, 04:43:53 PM »
Hi guys,

i'm trying to create dynamic Navmesh action for playmaker

the way seam easy to do following this tutorial in JS, i'm wondering why i can't successfully create this actions for playmaker ?

just take a look at this video:
https://www.youtube.com/watch?v=qWPwLv9NCds

and here is my code:
Code: [Select]
using UnityEngine;
using UnityEditor;

namespace HutongGames.PlayMaker.Actions
{

[ActionCategory(ActionCategory.NavMesh)]
[Tooltip("Allow generating NavMesh dynamicaly")]
public class NavMeshBuilder : FsmStateAction
{

// Code that runs on entering the state.
public override void OnEnter()
{
NavMeshBuilder.BuildNavMesh();
Finish();
}


}

}

and the error returned
Assets/PlayMaker/Actions/NavMesh/NavMeshBuilder.cs(15,40): error CS0117: `HutongGames.PlayMaker.Actions.NavMeshBuilder' does not contain a definition for `BuildNavMesh'

and the unity page for scripting:
../Unity/Editor/Data/Documentation/en/ScriptReference/NavMeshBuilder.html

so it should be possible isn't it ??

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: BuildNavMesh
« Reply #1 on: July 28, 2016, 06:42:27 AM »
is someone is able to convert this simple javascript script into C# ?
because it works pretty well and generate Navmesh on initialization of the scene.

Code: [Select]
#pragma strict

function Start () {
NavMeshBuilder.BuildNavMesh();

}

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: BuildNavMesh
« Reply #2 on: August 02, 2016, 01:51:43 AM »
no idea for this ?

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: BuildNavMesh
« Reply #3 on: August 02, 2016, 02:48:04 AM »
Hi,

First of all, Im a noob so I wont be able to provide any help in solving this. I do have something I would like to mention about the entire query (that although wont help, is quite important I think :( ).

Now I did a little research, because, (after watching the tutorial) like you, I thought this may be a pretty cool simple action to try and create (im rubbish at c#, but why not try lol).

What I found was a lot of people saying that you cannot build navmeshes during runtime. I was thinking 'what do they know, I just watched a tutorial on it!'. Then I went back to the tutorial and checked the comments and one guy did confirm this in the comments :( . Then I went back to unity forums and yup apparently what is shown in the tutorial will only work at runtime in the editor and not in any standalone published version of the game.

So that kind of makes it seem pretty useless to me now... (except for the script from the tutorial, that can be useful still if youre expecting to work heaily on the level layout as it will adjust the navmesh each time you test it after making changes to the level, but if that is the only real use for it, then  I think a playmaker action is useless as the script does the job just fine.)

If you must do it for some reason, I read this:
Quote
use 3rd party like Aphex and Aaron's astar

Also there are navmesh obstacles that will work in most cases where this would have been useful.

For all I know this may not be the case anymore (I hate trying to keep up to date with all the damn updates lol), but here are some recent topics confirming this:

http://answers.unity3d.com/questions/1149938/navmesh-at-runtime.html (March 2016)

http://forum.unity3d.com/threads/while-we-wait-for-navmesh-at-runtime-how-do-you-handle-dynamic-levels.391376/ (April 2016)

Good luck with it!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: BuildNavMesh
« Reply #4 on: August 02, 2016, 04:44:05 AM »
Hi,

 Yes, NavMeshBuilder is a "UnityEditor" class and so it can not be executed at runtime without the UnityEditor.

Bye,

 Jean

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: BuildNavMesh
« Reply #5 on: August 04, 2016, 09:30:10 AM »
ok, thanks for your answers, this is explaining a lot about unity workflow, i understand it better now.

i espect they'll update it later, for now, i'll do without it, or i'll have to fund another solution.

What is the best solution for randomly generated Levels ?
« Last Edit: August 04, 2016, 09:43:35 AM by blackant »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: BuildNavMesh
« Reply #6 on: August 04, 2016, 09:48:56 AM »
Maybe a work around could me NavMesh carving, depends on your level complexity, if its flat, you can carve obstacles (with no collision and invisible)…