1
因此,我正在使用流資產文件夾來存放我需要運行我的程序的一些信息。這裏是我如何確定使用的文件路徑:Android未找到文件路徑Unity 5
// Location of the top part of the query
public string fileLocation_queryTop = "/Bro/bro_Headers_TOP.json";
// We are on android
if(Application.platform == RuntimePlatform.Android)
{
assetPath = "jar:file://" + Application.dataPath + "!/assets";
}
// We are on iPhone
else if(Application.platform == RuntimePlatform.IPhonePlayer)
{
assetPath = Application.dataPath + "/Raw";
}
// We are on mac or windows
else
{
assetPath = Application.dataPath + "/StreamingAssets";
}
_query_TOP = File.ReadAllText(assetPath + fileLocation_queryTop);
這在Windows上正常工作,但我想今天爲Android構建。
這裏是我得到
我需要爲iOS使用WWW嗎? – BenjaFriend
你總是可以嘗試使用'System.IO',但由於資產也包裝在iOS上(至少我認爲),我會說是的。也使用** WWW **往往是一個好主意:) – Kardux
好酷,謝謝!我會給它一個 – BenjaFriend