Look At Constraint Source Count#
Animation / Constraints / Look At Constraint / Look At Constraint Source Count
Can Read
Cannot Write
Description#
The Source Count property of the Look At Constraint 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.Animations;
namespace VisualScript.Runtime
{
[Get]
[Title("Look At Constraint Source Count")]
[Category("Animation/Constraints/Look At Constraint/Source Count")]
[Description("The Source Count property of the Look At Constraint component")]
[Image(typeof(IconBullsEye), ColorTheme.Type.Pink)]
[Keywords("Track, Follow")]
[Serializable]
public class GenTypeInteger_LookAtConstraint_SourceCount : TypeNumber
{
[SerializeField] private GetGameObject m_LookAtConstraint = new GetGameObject(
new GenTypeGameObject_LookAtConstraint()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_LookAtConstraint.GetPreview(source);
if (instance == null) return default;
LookAtConstraint component = instance.GetComponent<LookAtConstraint>();
return component != null ? component.sourceCount : default;
}
public override double Get(Args args)
{
LookAtConstraint instance = this.m_LookAtConstraint.Get<LookAtConstraint>(args);
return instance != null
? instance.sourceCount
: default;
}
public override string ToString()
{
return $"{this.m_LookAtConstraint} Source Count";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}