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

Broadcast Game Object Message#

Game Object / Communication / 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#

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;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.