Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Position Constraint Weight#

Animation / Constraints / Position Constraint / Position Constraint Weight

  • Can Read

  • Can Write

Description#

The Weight property of the Position 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("Position Constraint Weight")]
    [Category("Animation/Constraints/Position Constraint/Weight")]
    [Description("The Weight property of the Position Constraint component")]

    [Image(typeof(IconPosition), ColorTheme.Type.Pink)]
    [Keywords("Location, Follow, Transform")]

    [Serializable]
    public class GenTypeNumber_PositionConstraint_Weight : TypeNumber
    {
        [SerializeField] private GetGameObject m_PositionConstraint = new GetGameObject(
            new GenTypeGameObject_PositionConstraint()
        );

        public override double GetPreview(GameObject source)
        {
            GameObject instance = this.m_PositionConstraint.GetPreview(source);
            if (instance == null) return default;

            PositionConstraint component = instance.GetComponent<PositionConstraint>();
            return component != null ? component.weight : default;
        }

        public override double Get(Args args)
        {
            PositionConstraint instance = this.m_PositionConstraint.Get<PositionConstraint>(args);
            return instance != null
                ? instance.weight
                : default;
        }

        public override void Set(double value, Args args)
        {
            PositionConstraint component = this.m_PositionConstraint.Get<PositionConstraint>(args);
            if (component != null) component.weight = (float) value;
        }

        public override string ToString()
        {
            return $"{this.m_PositionConstraint} Weight";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.