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