---
tags:
    - "Instructions"
    - "Conditions"
    - "Triggers"
    - "Event"
---

# Event

[Components](../index.md) / [Event](index.md) / **Event**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The Event component attached to a Game Object

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Inline(nameof(m_Value), typeof(Event), true)]
    
    [Title("Event")]
    [Category("Components/Event/Event")]
    [Description("The Event component attached to a Game Object")]
    
    [Image(typeof(IconInstructions), ColorTheme.Type.TextLight)]
    [Keywords("Instructions", "Conditions", "Triggers", "Event")]
    
    [Serializable]
    public class TypeGameObjectComponentEvent : TypeGameObject
    {
        [SerializeField] private Event m_Value;
        
        public TypeGameObjectComponentEvent()
        {
            this.m_Value = null;
        }
        
        public TypeGameObjectComponentEvent(Event component)
        {
            this.m_Value = component;
        }

        public override GameObject GetPreview(GameObject source) =>
            this.m_Value != null
                ? this.m_Value.gameObject
                : null;

        public override GameObject Get(Args args)
        {
            return this.m_Value != null
                ? this.m_Value.gameObject
                : null;
        }
        
        public override U Get<U>(Args args)
        {
            if (typeof(U) == typeof(Event))
            {
                return this.m_Value != null
                    ? this.m_Value as U
                    : null;
            }
            
            return base.Get<U>(args);
        }
        
        public override string ToString()
        {
            return TextUtils.Name(this.m_Value);
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
    }
}
```

