Aim Constraint Weight#
Animation / Constraints / Aim Constraint / Aim Constraint Weight
Can Read
Can Write
Description#
The Weight property of the Aim 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]
[Set]
[Title("Aim Constraint Weight")]
[Category("Animation/Constraints/Aim Constraint/Weight")]
[Description("The Weight property of the Aim Constraint component")]
[Image(typeof(IconCamera), ColorTheme.Type.Pink)]
[Keywords("Look, Track, Follow")]
[Serializable]
public class GenTypeNumber_AimConstraint_Weight : TypeNumber
{
[SerializeField] private GetGameObject m_AimConstraint = new GetGameObject(
new GenTypeGameObject_AimConstraint()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_AimConstraint.GetPreview(source);
if (instance == null) return default;
AimConstraint component = instance.GetComponent<AimConstraint>();
return component != null ? component.weight : default;
}
public override double Get(Args args)
{
AimConstraint instance = this.m_AimConstraint.Get<AimConstraint>(args);
return instance != null
? instance.weight
: default;
}
public override void Set(double value, Args args)
{
AimConstraint component = this.m_AimConstraint.Get<AimConstraint>(args);
if (component != null) component.weight = (float) value;
}
public override string ToString()
{
return $"{this.m_AimConstraint} Weight";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}