스크립트 경로
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public static void GetScriptPath([System.Runtime.CompilerServices.CallerFilePath] string filePath = "")
{
// 1. Script(.cs) Path
_ = filePath;
// 2. Folder Path
string folderPath = System.IO.Path.GetDirectoryName(filePath);
// 3. Specific Root Folder Path
string rootFolderName = @"Assets\";
int rootIndex = folderPath.IndexOf(rootFolderName);
if (rootIndex > -1)
{
string rootFolderPath = folderPath.Substring(rootIndex, folderPath.Length - rootIndex);
}
}
어셈블리 경로
1
2
3
4
5
string filePath =
System.Reflection.Assembly.GetExecutingAssembly().Location;
string folderPath =
System.IO.Path.GetDirectoryName(filePath);