部署到移动设备时不会加载来自 amazon s3 的资产
Assets from amazon s3 do not load when deployed to a mobile device
这是我第一次尝试使用amazon s3,我还在学习中。
我正在尝试从 Amazon s3 为一个简单的 AR 应用程序加载资产包。当相机正在查看特定图像时,我正在使用 Vuforia 加载蜘蛛。该资产在未从亚马逊加载时工作得很好,但现在在构建到我的 phone 时从未加载该资产,但它确实会统一加载。我已经设置了权限,所以每个人都可以从资产包中读取。
我不确定 android SDK 中是否有我需要做的事情。
这是我用于从 amazon s3 加载资产的脚本:
public Text debugText;
// initialization
void Start()
{
string url = "This is a url";
WWW www = new WWW(url);
StartCoroutine(WaitForReq(www));
}
IEnumerator WaitForReq(WWW www)
{
yield return www;
AssetBundle bundle = www.assetBundle;
if (www.error == null)
{
GameObject SPIDER = (GameObject)bundle.LoadAsset("SPIDER");
//For debugging, see if asset is being loaded
debugText.text = ("Object has loaded");
//Instantiates at the location of where the ImageTarget is
var loadedAsset = Instantiate(SPIDER, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
//Makes transform of loadedAsset the transform of the ImageTarget
loadedAsset.transform.parent = gameObject.transform;
loadedAsset.gameObject.active = false;
}
else
{
Debug.Log(www.error);
}
}
编辑:添加日志
08-26 13:45:07.598: I/Unity(10633): StopVuforia
08-26 13:45:07.598: I/Unity(10633):
08-26 13:45:07.598: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:45:46.320: W/UnityMain(10633): type=1400 audit(0.0:105566): avc:
denied { read } for name="version" dev="proc" ino=4026532375
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633
pgcomm="name.name"
08-26 13:45:46.403: I/Unity(10633): StartVuforia
08-26 13:45:46.403: I/Unity(10633):
08-26 13:45:46.403: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:45:46.400: W/UnityMain(10633): type=1400 audit(0.0:105567): avc:
denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=15357
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:camera_prop:s0
tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633
pgcomm="name.name"
08-26 13:46:19.877: I/Unity(10633): StopVuforia
08-26 13:46:19.877: I/Unity(10633):
08-26 13:46:19.877: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:46:27.050: W/UnityMain(10633): type=1400 audit(0.0:105655): avc: denied { read } for name="version" dev="proc" ino=4026532375 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633 pgcomm="name.name"
08-26 13:46:27.089: I/Unity(10633): StartVuforia
08-26 13:46:27.089: I/Unity(10633):
08-26 13:46:27.089: I/Unity(10633): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:46:27.080: W/UnityMain(10633): type=1400 audit(0.0:105656): avc: denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=15357 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:camera_prop:s0 tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633 pgcomm="name.name"
好的,谢谢 dome12b。感谢您发布如何让 android 调试器运行,我能够自己解决它。原来在我开始这个项目的时候,我统一创建了资产包到错误的构建目标。我所要做的就是将资产包的构建目标更改为 android 并且很快,它现在可以工作了!。再次感谢您为我指明了正确的方向。
这是我第一次尝试使用amazon s3,我还在学习中。 我正在尝试从 Amazon s3 为一个简单的 AR 应用程序加载资产包。当相机正在查看特定图像时,我正在使用 Vuforia 加载蜘蛛。该资产在未从亚马逊加载时工作得很好,但现在在构建到我的 phone 时从未加载该资产,但它确实会统一加载。我已经设置了权限,所以每个人都可以从资产包中读取。
我不确定 android SDK 中是否有我需要做的事情。
这是我用于从 amazon s3 加载资产的脚本:
public Text debugText;
// initialization
void Start()
{
string url = "This is a url";
WWW www = new WWW(url);
StartCoroutine(WaitForReq(www));
}
IEnumerator WaitForReq(WWW www)
{
yield return www;
AssetBundle bundle = www.assetBundle;
if (www.error == null)
{
GameObject SPIDER = (GameObject)bundle.LoadAsset("SPIDER");
//For debugging, see if asset is being loaded
debugText.text = ("Object has loaded");
//Instantiates at the location of where the ImageTarget is
var loadedAsset = Instantiate(SPIDER, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
//Makes transform of loadedAsset the transform of the ImageTarget
loadedAsset.transform.parent = gameObject.transform;
loadedAsset.gameObject.active = false;
}
else
{
Debug.Log(www.error);
}
}
编辑:添加日志
08-26 13:45:07.598: I/Unity(10633): StopVuforia
08-26 13:45:07.598: I/Unity(10633):
08-26 13:45:07.598: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:45:46.320: W/UnityMain(10633): type=1400 audit(0.0:105566): avc:
denied { read } for name="version" dev="proc" ino=4026532375
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0
tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633
pgcomm="name.name"
08-26 13:45:46.403: I/Unity(10633): StartVuforia
08-26 13:45:46.403: I/Unity(10633):
08-26 13:45:46.403: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:45:46.400: W/UnityMain(10633): type=1400 audit(0.0:105567): avc:
denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=15357
scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:camera_prop:s0
tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633
pgcomm="name.name"
08-26 13:46:19.877: I/Unity(10633): StopVuforia
08-26 13:46:19.877: I/Unity(10633):
08-26 13:46:19.877: I/Unity(10633): (Filename:
./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:46:27.050: W/UnityMain(10633): type=1400 audit(0.0:105655): avc: denied { read } for name="version" dev="proc" ino=4026532375 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633 pgcomm="name.name"
08-26 13:46:27.089: I/Unity(10633): StartVuforia
08-26 13:46:27.089: I/Unity(10633):
08-26 13:46:27.089: I/Unity(10633): (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
08-26 13:46:27.080: W/UnityMain(10633): type=1400 audit(0.0:105656): avc: denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=15357 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:camera_prop:s0 tclass=file permissive=0 ppid=1024 pcomm="main" pgid=10633 pgcomm="name.name"
好的,谢谢 dome12b。感谢您发布如何让 android 调试器运行,我能够自己解决它。原来在我开始这个项目的时候,我统一创建了资产包到错误的构建目标。我所要做的就是将资产包的构建目标更改为 android 并且很快,它现在可以工作了!。再次感谢您为我指明了正确的方向。