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