Nav Mesh Agent Set Area Cost#
Navigation / Nav Mesh Agent / Nav Mesh Agent Set Area Cost
Description#
Executes the Set Area Cost method on the Nav Mesh Agent component
Parameters#
| Name | Description |
|---|---|
| Area Index | |
| Area Cost |
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.AI;
namespace VisualScript.Runtime
{
[Title("Nav Mesh Agent Set Area Cost")]
[Category("Navigation/Nav Mesh Agent/Set Area Cost")]
[Description("Executes the Set Area Cost method on the Nav Mesh Agent component")]
[Image(typeof(IconNavmeshAgent), ColorTheme.Type.Red)]
[Keywords("Navigation, NavMesh, AI, Pathfinding, Agent")]
[Parameter("Area Index")]
[Parameter("Area Cost")]
[Serializable]
public class GenInstructionNavMeshAgent_SetAreaCost_2 : Instruction
{
[SerializeField] private GetGameObject m_NavMeshAgent = new GetGameObject(
new GenTypeGameObject_NavMeshAgent()
);
[SerializeField] private GetInteger m_AreaIndex = new GetInteger();
[SerializeField] private GetNumber m_AreaCost = new GetNumber();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Set Area Cost");
return $"{this.m_NavMeshAgent} {method} ({this.m_AreaIndex}, {this.m_AreaCost})";
}
protected override Awaitable Run(Args args)
{
NavMeshAgent component = this.m_NavMeshAgent.Get<NavMeshAgent>(args);
if (component == null) return Done;
component.SetAreaCost(
(int) this.m_AreaIndex.Get(args),
(float) this.m_AreaCost.Get(args)
);
return Done;
}
}
}