Polygon Collider 2D Path Count#
Physics 2D / Collider 2D / Polygon Collider 2D / Polygon Collider 2D Path Count
Can Read
Can Write
Description#
The Path Count property of the Polygon Collider 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("Polygon Collider 2D Path Count")]
[Category("Physics 2D/Collider 2D/Polygon Collider 2D/Path Count")]
[Description("The Path Count property of the Polygon Collider 2D component")]
[Image(typeof(IconPentagonOutline), ColorTheme.Type.Lime, typeof(Badge2D))]
[Keywords("Physics, 2D")]
[Serializable]
public class GenTypeInteger_PolygonCollider2D_PathCount : TypeNumber
{
[SerializeField] private GetGameObject m_PolygonCollider2D = new GetGameObject(
new GenTypeGameObject_PolygonCollider2D()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_PolygonCollider2D.GetPreview(source);
if (instance == null) return default;
PolygonCollider2D component = instance.GetComponent<PolygonCollider2D>();
return component != null ? component.pathCount : default;
}
public override double Get(Args args)
{
PolygonCollider2D instance = this.m_PolygonCollider2D.Get<PolygonCollider2D>(args);
return instance != null
? instance.pathCount
: default;
}
public override void Set(double value, Args args)
{
PolygonCollider2D component = this.m_PolygonCollider2D.Get<PolygonCollider2D>(args);
if (component != null) component.pathCount = (int) value;
}
public override string ToString()
{
return $"{this.m_PolygonCollider2D} Path Count";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}