gpt4 book ai didi

c# - APPNAME 是经过优化编译的——步进可能会表现得很奇怪;变量可能不可用

转载 作者:行者123 更新时间:2023-11-28 21:35:12 25 4
gpt4 key购买 nike

此项目在 Unity3d 中开发并构建到 iOS。

这是我的 .cs 文件。

IEnumerator DownloadModel(string modelUrl)
{
isDownloading = true;
// Wait for the Caching system to be ready
while (!Caching.ready)
yield return null;

// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
WWW www = WWW.LoadFromCacheOrDownload (modelUrl, 1);
Debug.Log ("modelURL : " + modelUrl);
while (!www.isDone) {
progressText.text = "Progress : " + (www.progress * 100).ToString ("N0") + "%";
Debug.Log("Download Progress : " + (www.progress * 100).ToString ("N0") + "%");
yield return null;
}

yield return www;

isDownloading = false;

if (www.error != null) {
throw new UnityException ("WWW download had an error:" + www.error);
}

AssetBundle bundle = www.assetBundle;

downloadedObjectContainer = bundle.LoadAllAssets ();

// tempObj = Instantiate(downloadedObjectContainer[0]) as GameObject;
//
// tempObj.transform.SetParent(this.transform);
isDownloading = false;

// Unload the AssetBundles compressed contents to conserve memory
bundle.Unload (false);
// memory is freed from the web stream (www.Dispose() gets called implicitly)

Debug.LogWarning ("START CALLING OUT OBJECT");
if (downloadedObjectContainer[0] != null) {

Debug.Log("Downloadable content count : " + downloadedObjectContainer.Length );

currentDownloadedModel = Instantiate(downloadedObjectContainer[0]) as GameObject;
Debug.Log("OBJECT INSTANTIATE.");

currentDownloadedModel.transform.SetParent(this.transform);

//set the ARContent and ImageTarget
sic.setARContentAndMarker(currentDownloadedModel, ImageTarget);
Debug.Log("CONTENT MARKER SET.");

currentDownloadedModel.SetActive(true);

}

Debug.LogWarning ("COROUTINE FINISHED");
}

我的“currentDownloadedModel”在顶部声明为 GameObject。

public class cloudTrackableEventHandler : MonoBehaviour{

GameObject currentDownloadedModel;

当我将我的应用程序构建到 Android 时,完全没有问题。但是一旦我在 iOS 中构建它,就会发生此错误

START CALLING OUT OBJECT

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)

Downloadable content count : 1

(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)

MarcV2 was compiled with optimization - stepping may behave oddly; variables may not be available.

通过 Debug.Log(),我发现当我想将 currentDownloadedModel 分配给我实例化的模型时会出现问题。谁可以帮我这个事 ?提前致谢。

注意:unity播放器设置中的“脚本调用优化”设置为“缓慢且安全”

最佳答案

对于同样遇到此问题的任何人,请尝试在"file">“build设置”>“播放器设置”(iOS) 中取消选中“剥离引擎代码”。

http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html

关于c# - APPNAME 是经过优化编译的——步进可能会表现得很奇怪;变量可能不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34170108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com