---
tags:
    - "Value"
    - "Constant"
---

# Scene by Path

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

A Scene identified by its path in the Build Settings

## Code

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

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Scene by Path")]
    [Category("Scene by Path")]
    
    [Description("A Scene identified by its path in the Build Settings")]
    [Image(typeof(IconUnity), ColorTheme.Type.Gray)]
    
    [Keywords("Value", "Constant")]
    
    [Serializable]
    public class TypeSceneByPath : TypeScene
    {
        [SerializeField] private GetString m_Path;

        public override int GetPreview(GameObject source) => SceneReference.GetSceneIndexFromPath(this.m_Path.GetPreview(source));

        public TypeSceneByPath() : this(string.Empty)
        {
            this.m_Path = new GetString();
        }
        
        public TypeSceneByPath(string path)
        {
            this.m_Path = new GetString(path);
        }

        public override int Get(Args args)
        {
            string path = this.m_Path.Get(args);
            return SceneReference.GetSceneIndexFromPath(path);
        }

        public override string ToString()
        {
            return this.m_Path.ToString();
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

