コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】EditorBuildSettingsScene.GetActiveSceneList の使用例

概要

var scenePaths = EditorBuildSettings.scenes
    .Where( x => x.enabled )
    .Select( x => x.path )
    .ToArray()
;

foreach ( var scenePath in scenePaths )
{
    Debug.Log( scenePath );
}

上記のような処理を

var scenes     = EditorBuildSettings.scenes;
var scenePaths = EditorBuildSettingsScene.GetActiveSceneList( scenes );

foreach ( var scenePath in scenePaths )
{
    Debug.Log( scenePath );
}

このように記述できる。