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

Game Object has Component#

Game Object / Component / Game Object has Component Component Name

Description#

Returns true the targeted Game Object has the specified component attached

Parameters#

Name Description
Game Object The Game Object targeted
Component The Component to check for

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Game Object has Component")]
    [Image(typeof(IconCubeSolid), ColorTheme.Type.TextLight)]
    
    [Description("Returns true the targeted Game Object has the specified component attached")]
    [Category("Game Object/Component/Has Component", "Component Name")]
    
    [Parameter("Game Object", "The Game Object targeted")]
    [Parameter("Component", "The Component to check for")]
    
    [Serializable]
    public class ConditionCoreGameObjectHasComponent : Condition
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();
        [SerializeField] private GetString m_Component = new GetString();

        protected override string GetTitle(GameObject source) => $"{this.m_GameObject} has {this.m_Component}";

        protected override bool Run(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            string componentName = this.m_Component.Get(args);
            
            return gameObject != null && gameObject.GetComponent(componentName) != null;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.