Collection Is Empty#
Collections / Collection Is Empty
Can Read
Cannot Write
Description#
Returns True if the collection does not have any item
Parameters#
| Name | Description |
|---|---|
| Collection | The collection whose items are counted |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Collection Is Empty")]
[Category("Collections/Is Empty")]
[Description("Returns True if the collection does not have any item")]
[Image(typeof(IconStack), ColorTheme.Type.Teal, typeof(BadgeCross))]
[Parameter("Collection", "The collection whose items are counted")]
[Keywords("None", "Zero", "Count", "Length", "Size", "List", "Array")]
[Serializable]
public class TypeBoolCollectionIsEmpty : TypeBool
{
[SerializeField] private GetCollection m_Collection = new GetCollection();
public override bool Get(Args args)
{
return this.m_Collection.Capture(args) == 0;
}
public override string ToString()
{
return $"{this.m_Collection} is Empty";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}