public static string RelativePath(MonoBehaviour script){
string path = "";
#if UNITY_EDITOR
MonoScript monoScript = MonoScript.FromMonoBehaviour(script);
path = AssetDatabase.GetAssetPath(monoScript);
#endif
return path;
}
//使用 获取脚本A的相对路径
public class A
{
//ProjectPath为静态类,RelativePath为上面的方法
public string RelativePath()
{
return ProjectPath.RelativePath(this);
}
}
unity 获取脚本的相对路径
猜你喜欢
转载自blog.csdn.net/weixin_44238530/article/details/121874387
今日推荐
周排行