Cloth Sleep Threshold#
Physics 3D / Cloth / Cloth Sleep Threshold
Can Read
Can Write
Description#
The Sleep Threshold property of the Cloth 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;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("Cloth Sleep Threshold")]
[Category("Physics 3D/Cloth/Sleep Threshold")]
[Description("The Sleep Threshold property of the Cloth component")]
[Image(typeof(IconShirt), ColorTheme.Type.Lime)]
[Keywords("Physics, 3D, Kinematic")]
[Serializable]
public class GenTypeNumber_Cloth_SleepThreshold : TypeNumber
{
[SerializeField] private GetGameObject m_Cloth = new GetGameObject(
new GenTypeGameObject_Cloth()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_Cloth.GetPreview(source);
if (instance == null) return default;
Cloth component = instance.GetComponent<Cloth>();
return component != null ? component.sleepThreshold : default;
}
public override double Get(Args args)
{
Cloth instance = this.m_Cloth.Get<Cloth>(args);
return instance != null
? instance.sleepThreshold
: default;
}
public override void Set(double value, Args args)
{
Cloth component = this.m_Cloth.Get<Cloth>(args);
if (component != null) component.sleepThreshold = (float) value;
}
public override string ToString()
{
return $"{this.m_Cloth} Sleep Threshold";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}