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

Main Camera#

Components / Camera / Main Camera

  • Can Read

  • Cannot Write

Description#

The Camera marked with the 'Main Camera' tag

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Main Camera")]
    [Category("Components/Camera/Main Camera")]
    [Description("The Camera marked with the 'Main Camera' tag")]
    
    [Image(typeof(IconCamera), ColorTheme.Type.Lime)]
    [Keywords("Transform", "Primary")]
    
    [Serializable]
    public class TypeGameObjectCameraMain : TypeGameObject
    {
        public override GameObject GetPreview(GameObject source)
        {
            Camera main = Camera.main;
            return main != null ? main.gameObject : null;
        }

        public override GameObject Get(Args args)
        {
            Camera main = Camera.main;
            return main != null ? main.gameObject : null;
        }
        
        public override U Get<U>(Args args)
        {
            if (typeof(U) == typeof(Camera))
            {
                return Camera.main as U;
            }
            
            return base.Get<U>(args);
        }
        
        public override string ToString()
        {
            return "Main Camera";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.