# Game Object has Component

[Game Object](../index.md) / [Component](index.md) / **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

```cs
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;
        }
    }
}
```

