format
typescript
NavMeshAgent.areaMaskclass: NavMeshAgent
description
Specifies on which navigation meshes the agent is allowed to move.
Only integers are allowed, and the value is the result of bitwise OR operation on the values of the areas.
parameter
| param_name | type | description |
|---|
reture
| type | description |
|---|---|
number | The result of bitwise OR operation on the values of the areas where the agent is allowed to move. |
code example
javascript
//agent is only allowed to move on area_1 and area_2
let obj = new GameObject();
let com = obj.AddComponent<NavMeshAgent>(NavMeshAgent);
let area_1 = 1 << 2;
let area_2 = 1 << 8;
com.areaMask = area_1 | area_2;
Debug.Log("NavMeshAgent: areaMask = ", com.areaMask);