# Broadcast Game Object Message

[Game Object](../index.md) / [Communication](index.md) / **Broadcast Game Object Message**

## Description

Calls the specified method on every component attached to the Game Object and children

!!! note
    This instruction does not support sending messages with a value parameter

## Parameters

| Name | Description |
| :--- | :---------- |
| Game Object | The targeted Game Object that receives the message |
| Message | The name of the method to call |
| Options | Whether an error should be raised if the method does not exist |

## Code

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

namespace VisualScript.Runtime
{
    [Title("Broadcast Game Object Message")]
    [Image(typeof(IconMessage), ColorTheme.Type.TextLight, typeof(BadgeArrowDown))]
    
    [Description("Calls the specified method on every component attached to the Game Object and children")]
    [Category("Game Object/Communication/Broadcast Message")]
    
    [Parameter("Game Object", "The targeted Game Object that receives the message")]
    [Parameter("Message", "The name of the method to call")]
    [Parameter("Options", "Whether an error should be raised if the method does not exist")]
    
    [Note("This instruction does not support sending messages with a value parameter")]
    
    [Serializable]
    public class InstructionCoreGameObjectBroadcastMessage : Instruction
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject(
            new TypeGameObjectPrefab()
        );
        
        [SerializeField] private GetString m_Message = new GetString();
        
        [SerializeField]
        private SendMessageOptions m_Options = SendMessageOptions.DontRequireReceiver;

        protected override string GetTitle(GameObject source) =>
            $"Broadcast Message {this.m_Message} on {this.m_GameObject}";

        protected override Awaitable Run(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            if (gameObject == null) return Done;
            
            string message = this.m_Message.Get(args);
            gameObject.BroadcastMessage(message, this.m_Options);
            return Done;
        }
    }
}
```

