Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

First#

Collections / First

  • Can Read

  • Cannot Write

Description#

The Game Object placed at the beginning of a collection

Parameters#

Name Description
Collection The collection the Game Object is taken from

Code#

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("First")]
    [Category("Collections/First")]

    [Description("The Game Object placed at the beginning of a collection")]
    [Image(typeof(IconListFirst), ColorTheme.Type.Teal)]

    [Parameter("Collection", "The collection the Game Object is taken from")]

    [Keywords("Head", "Start", "Begin", "Top", "Index", "List", "Array")]

    [Serializable]
    public class TypeGameObjectCollectionFirst : TypeGameObject
    {
        [SerializeField] private GetCollectionGameObjects m_Collection = new GetCollectionGameObjects();

        public override GameObject Get(Args args)
        {
            List<GameObject> buffer = ListPool<GameObject>.Get();

            try
            {
                this.m_Collection.Get(args, buffer);

                GameObject result = buffer.Count > 0 ? buffer[0] : null;

                return result;
            }
            finally
            {
                ListPool<GameObject>.Release(buffer);
            }
        }

        public override string ToString()
        {
            return $"First of {this.m_Collection}";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.