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