Nav Mesh Agent Avoidance Priority#
Navigation / Nav Mesh Agent / Nav Mesh Agent Avoidance Priority
Can Read
Can Write
Description#
The Avoidance Priority property of the Nav Mesh Agent component
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
{
[Get]
[Set]
[Title("Nav Mesh Agent Avoidance Priority")]
[Category("Navigation/Nav Mesh Agent/Avoidance Priority")]
[Description("The Avoidance Priority property of the Nav Mesh Agent component")]
[Image(typeof(IconNavmeshAgent), ColorTheme.Type.Red)]
[Keywords("Navigation, NavMesh, AI, Pathfinding, Agent")]
[Serializable]
public class GenTypeInteger_NavMeshAgent_AvoidancePriority : TypeNumber
{
[SerializeField] private GetGameObject m_NavMeshAgent = new GetGameObject(
new GenTypeGameObject_NavMeshAgent()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_NavMeshAgent.GetPreview(source);
if (instance == null) return default;
NavMeshAgent component = instance.GetComponent<NavMeshAgent>();
return component != null ? component.avoidancePriority : default;
}
public override double Get(Args args)
{
NavMeshAgent instance = this.m_NavMeshAgent.Get<NavMeshAgent>(args);
return instance != null
? instance.avoidancePriority
: default;
}
public override void Set(double value, Args args)
{
NavMeshAgent component = this.m_NavMeshAgent.Get<NavMeshAgent>(args);
if (component != null) component.avoidancePriority = (int) value;
}
public override string ToString()
{
return $"{this.m_NavMeshAgent} Avoidance Priority";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}