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