ソースコード
using System.IO; public static class PathUtils { /// <summary> /// 文字列の配列を 1 つのパスに結合します /// </summary> public static string Combine( params string[] paths ) { return paths .Aggregate( ( a, b ) => Path.Combine( a, b ) ) .Replace( "\\", "/" ); } }
使い方
PathUtils.Combine( "Assets", "Prefabs", "Player.prefab" ); // Assets/Prefabs/Player.prefab