Search Unity

how to change navmesh agent Area mask through code?

Discussion in 'Navigation' started by TKDHayk, Dec 25, 2016.

  1. TKDHayk

    TKDHayk

    Joined:
    Dec 22, 2015
    Posts:
    130
    I need to change the area mask of my navmesh agent through code at runtime, to allow my agent to move to different areas of the map. How is this done through code? For example, I need to change the Nav mesh agent's area mask from "walkable" to "everything". Thanks.
     
  2. Jakob_Unity

    Jakob_Unity

    Joined:
    Dec 25, 2011
    Posts:
    269
  3. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    convert layer name to layer int using NavMesh.GetAreaFromName()
     
    ZammyIsOnFire1 and Wappenull like this.
  4. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393