我正在使用Unity的地平面功能放置3D动画模型。但是,我现在正在使用AssetBundle功能下载此3d模型,并需要使用脚本将其放置在Ground Plane Stage上。
但是,当我将其部署到android设备上时,它不会显示...
我正在使用支持GroundPlane检测的Xiaomi Redmi 3s。
我已添加脚本以将资产捆绑包下载到“平面查找器”中
AssetbundleDownloadingScript:
public class AssetLoader : MonoBehaviour
{
public static AssetLoader Instance;
public string url = "myurl";
public int version = 1;
public string AssetName;
//public Text infoText;
public string infoText = "";
AssetBundle bundle;
void Awake()
{
Instance = this;
DownloadAsset();
}
void OnDisable()
{
//AssetBundleManager.Unload(url, version);
}
public void DownloadAsset()
{
// bundle = AssetBundleManager.getAssetBundle (url, version);
// Debug.Log(bundle);
if (!bundle)
StartCoroutine(DownloadAssetBundle());
}
IEnumerator DownloadAssetBundle()
{
yield return StartCoroutine(AssetBundleManager.downloadAssetBundle(url, version));
bundle = AssetBundleManager.getAssetBundle(url, version);
if (bundle != null)
infoText = "Download Success.....";
else
infoText = "Download error please retry";
GameObject santaasset = bundle.LoadAsset("animation_keyframes_increase_v1", typeof(GameObject)) as GameObject;
//here script attached to plane finder,get 1st child of planefinder
var child = gameObject.transform.GetChild(0);
if (santaasset != null)
{
santaasset.transform.transform.Rotate(new Vector3(0, 180, 0));
santaasset.transform.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
santaasset.transform.transform.SetParent(child.transform, false);
}
bundle.Unload(false);
}
public void SetInfoText(string text)
{
//infoText.text = text;
}
void OnGUI()
{
GUILayout.Label("Dummy Label:" + infoText);
}
}
这是我的场景的屏幕截图:
关于我在做什么错的任何建议吗?谢谢。
慕森卡
相关分类