Rigidbody 2D Use Auto Mass#
Physics 2D / Rigidbody 2D / Rigidbody 2D Use Auto Mass
Can Read
Can Write
Description#
The Use Auto Mass property of the Rigidbody 2D 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 2D Use Auto Mass")]
[Category("Physics 2D/Rigidbody 2D/Use Auto Mass")]
[Description("The Use Auto Mass property of the Rigidbody 2D component")]
[Image(typeof(IconPhysics), ColorTheme.Type.Lime, typeof(Badge2D))]
[Keywords("Physics, 2D")]
[Serializable]
public class GenTypeBool_Rigidbody2D_UseAutoMass : TypeBool
{
[SerializeField] private GetGameObject m_Rigidbody2D = new GetGameObject(
new GenTypeGameObject_Rigidbody2D()
);
public override bool GetPreview(GameObject source)
{
GameObject instance = this.m_Rigidbody2D.GetPreview(source);
if (instance == null) return default;
Rigidbody2D component = instance.GetComponent<Rigidbody2D>();
return component != null ? component.useAutoMass : default;
}
public override bool Get(Args args)
{
Rigidbody2D instance = this.m_Rigidbody2D.Get<Rigidbody2D>(args);
return instance != null
? instance.useAutoMass
: default;
}
public override void Set(bool value, Args args)
{
Rigidbody2D component = this.m_Rigidbody2D.Get<Rigidbody2D>(args);
if (component != null) component.useAutoMass = (bool) value;
}
public override string ToString()
{
return $"{this.m_Rigidbody2D} Use Auto Mass";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}