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

Send Game Object Message#

Game Object / Communication / Send Game Object Message

Description#

Calls the specified method on every component attached to the targeted object

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("Send Game Object Message")]
    [Image(typeof(IconMessage), ColorTheme.Type.TextLight)]
    
    [Description("Calls the specified method on every component attached to the targeted object")]
    [Category("Game Object/Communication/Send 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 InstructionCoreGameObjectSendMessage : 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) => $"Send 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.SendMessage(message, this.m_Options);
            return Done;
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.