GetAllScenes.cs 606 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
public class GetAllScenes : Command
{
    public override string Execute()
    {
        UnityEngine.Debug.Log("getAllScenes");
        System.Collections.Generic.List<string> SceneNames = new System.Collections.Generic.List<string>();
        for (int i = 0; i < UnityEngine.SceneManagement.SceneManager.sceneCountInBuildSettings; i++)
        {
            var s = System.IO.Path.GetFileNameWithoutExtension(UnityEngine.SceneManagement.SceneUtility.GetScenePathByBuildIndex(i));
            SceneNames.Add(s);
        }
        return Newtonsoft.Json.JsonConvert.SerializeObject(SceneNames);
    }
}