Search Unity

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

Discussion in 'Scripting' started by Dinksg, Dec 9, 2015.

  1. Dinksg

    Dinksg

    Joined:
    May 14, 2015
    Posts:
    3
    This is my .cs file.

    Code (csharp):
    1.  
    2. IEnumerator DownloadModel(string modelUrl)
    3.         {
    4.             isDownloading = true;
    5.             // Wait for the Caching system to be ready
    6.             while (!Caching.ready)
    7.                 yield return null;
    8.            
    9.             // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
    10.             WWW www = WWW.LoadFromCacheOrDownload (modelUrl, 1);
    11.             Debug.Log ("modelURL : " + modelUrl);
    12.             while (!www.isDone) {
    13.                 progressText.text = "Progress : " + (www.progress * 100).ToString ("N0") + "%";
    14.                 Debug.Log("Download Progress : " + (www.progress * 100).ToString ("N0") + "%");
    15.                 yield return null;
    16.             }
    17.            
    18.             yield return www;  
    19.  
    20.             isDownloading = false;
    21.            
    22.             if (www.error != null) {
    23.                 throw new UnityException ("WWW download had an error:" + www.error);
    24.             }
    25.            
    26.             AssetBundle bundle = www.assetBundle;
    27.            
    28.             downloadedObjectContainer = bundle.LoadAllAssets ();
    29.            
    30.             //              tempObj = Instantiate(downloadedObjectContainer[0]) as GameObject;
    31.             //
    32.             //              tempObj.transform.SetParent(this.transform);
    33.             isDownloading = false;
    34.            
    35.             // Unload the AssetBundles compressed contents to conserve memory
    36.             bundle.Unload (false);
    37.             // memory is freed from the web stream (www.Dispose() gets called implicitly)
    38.            
    39.             Debug.LogWarning ("START CALLING OUT OBJECT");
    40.             if (downloadedObjectContainer[0] != null) {
    41.                
    42.                 Debug.Log("Downloadable content count : " + downloadedObjectContainer.Length );
    43.                
    44.                 currentDownloadedModel = Instantiate(downloadedObjectContainer[0]) as GameObject;
    45.                 Debug.Log("OBJECT INSTANTIATE.");
    46.  
    47.                 currentDownloadedModel.transform.SetParent(this.transform);
    48.  
    49.                 //set the ARContent and ImageTarget
    50.                 sic.setARContentAndMarker(currentDownloadedModel, ImageTarget);
    51.                 Debug.Log("CONTENT MARKER SET.");
    52.  
    53.                 currentDownloadedModel.SetActive(true);
    54.                
    55.             }
    56.            
    57.             Debug.LogWarning ("COROUTINE FINISHED");
    58.         }
    59.  
    and my "currentDownloadedModel" is declared at the top as GameObject.

    Code (csharp):
    1.  
    2. public class cloudTrackableEventHandler : MonoBehaviour{
    3.  
    4. GameObject currentDownloadedModel;
    5.  
    When i build my App to Android, there is no problem at all. But once i build it in iOS, this error occurs
    Code (csharp):
    1.  
    2. START CALLING OUT OBJECT
    3.  
    4. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
    5.  
    6. Downloadable content count : 1
    7.  
    8. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)
    9.  
    10. MarcV2 was compiled with optimization - stepping may behave oddly; variables may not be available.
    11.  

    By the Debug.Log(), I found out that the problem occurs when I want to assign the currentDownloadedModel with the model i instantiate. Can anyone help me on this ? Thanks in advance.

    Note : the "Script call optimization" at the unity player settings is set to "slow and safe"
     
  2. Dinksg

    Dinksg

    Joined:
    May 14, 2015
    Posts:
    3
  3. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    221
    I am facing same issue.

    For anyone who also face this problem, try uncheck the "Strip Engine Code" at File > Build Settings > Player Settings (iOS).

    This option is not available in unity 5.3.5.

    Please let me know if anyone fixed it.
     
  4. Sandip_Artoon

    Sandip_Artoon

    Joined:
    Mar 2, 2017
    Posts:
    1
    Unity 5.5.0f3 & Xcode 8.2.1 ,, I uncheck the "Strip Engine Code" at File > Build Settings > Player Settings (iOS).
    i also try with "Optimization Level" set => None.
    but still my app crash sometimes .
    Please post solution ,iff anyone fixed it.
     
    allanmacatingrao likes this.
  5. Aerhart941

    Aerhart941

    Joined:
    Apr 7, 2019
    Posts:
    61
    This is INCREDIBLY frustrating and is still happening to me almost 3 years later. Has anyone found a fix?
     
  6. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    112
    Its happening to me as well....anyone?
     
  7. kk3hi3123

    kk3hi3123

    Joined:
    Aug 17, 2016
    Posts:
    31
    In my case, the application using too much memories causes the testing device crashes. You can test it with a better device. My application crashes in iPhone7 but not in iPhone7 Plus. And you can also check it in the Memory column in the left.



    If application crashes when loading scene, here is the solution, or suggestion.

    Assume there are 2 scenes, A and B. Both of them cost 1GB memory.
    When A -> B, A will be destroyed after B is loaded, which means 2GB is requested when A + B. It is too heavy for mobile.
    So I add scene C, a middleware cost 0.1GB memory.
    And now I go to scene B through A -> C -> B.
    A + C request 1.1GB, then Scene A releases.
    After that, C -> B request 1.1GB.
    The maximum memory of loading scene from A to B decrease from 2GB to 1.1GB. It solved my application crashing problem.

    Hope it helps.