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

Set Toggle Graphic#

UI / Interaction / Toggle / Set Toggle Graphic

Description#

Sets the Graphic field of Toggle component

Parameters#

Name Description
Toggle
Value

Code#

// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.UI;

namespace VisualScript.Runtime
{
    [Title("Set Toggle Graphic")]
    [Category("UI/Interaction/Toggle/Graphic")]
    [Description("Sets the Graphic field of Toggle component")]
    
    [Image(typeof(IconToggleOn), ColorTheme.Type.TextLight)]
    [Keywords("UI, User, Interface, Checkbox")]
    
    [Parameter("Toggle")]
    [Parameter("Value")]
    
    [Serializable]
    public class GenInstructionGameObject_Toggle_SetGraphic : Instruction
    {
        [SerializeField] private GetGameObject m_Toggle = new GetGameObject(
            new GenTypeGameObject_Toggle()
        );
        
        [SerializeField] private GetGameObject m_Value = new GetGameObject();
        
        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Graphic");
            return $"{this.m_Toggle} {member} = {this.m_Value}";
        }
        
        protected override Awaitable Run(Args args)
        {
            Toggle component = this.m_Toggle.Get<Toggle>(args);
            if (component == null) return Done;
            
            component.graphic = this.m_Value.Get<Graphic>(args);
            
            return Done;
        }
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.