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

Scale Constraint Weight#

Animation / Constraints / Scale Constraint / Scale Constraint Weight

  • Can Read

  • Can Write

Description#

The Weight property of the Scale 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("Scale Constraint Weight")]
    [Category("Animation/Constraints/Scale Constraint/Weight")]
    [Description("The Weight property of the Scale Constraint component")]
    
    [Image(typeof(IconScale), ColorTheme.Type.Pink)]
    [Keywords("Size, Bounds, Transform")]
    
    [Serializable]
    public class GenTypeNumber_ScaleConstraint_Weight : TypeNumber
    {
        [SerializeField] private GetGameObject m_ScaleConstraint = new GetGameObject(
            new GenTypeGameObject_ScaleConstraint()
        );
        
        public override double GetPreview(GameObject source)
        {
            GameObject instance = this.m_ScaleConstraint.GetPreview(source);
            if (instance == null) return default;
            
            ScaleConstraint component = instance.GetComponent<ScaleConstraint>();
            return component != null ? component.weight : default;
        }
        
        public override double Get(Args args)
        {
            ScaleConstraint instance = this.m_ScaleConstraint.Get<ScaleConstraint>(args);
            return instance != null
                ? instance.weight
                : default;
        }
        
        public override void Set(double value, Args args)
        {
            ScaleConstraint component = this.m_ScaleConstraint.Get<ScaleConstraint>(args);
            if (component != null) component.weight = (float) value;
        }
        
        public override string ToString()
        {
            return $"{this.m_ScaleConstraint} Weight";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.