APPNAME是用优化编译的——步进可能表现得很奇怪;变量可能不可用
本文关键字:变量 编译 步进 优化 APPNAME | 更新日期: 2023-09-27 18:26:09
该项目在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播放器设置中的"脚本调用优化"设置为"缓慢且安全"
对于同样面临此问题的人,请尝试在文件>构建设置>播放器设置(iOS)中取消选中"Strip Engine Code"。
http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html