Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Mobile Fatal error! CheckDisallowAllocation. Allocating memory when it's not allowed to allocate memory

Discussion in '5.4 Beta' started by Protozoaire, Apr 11, 2016.

  1. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    Unity 5.4.0b9 (64-bit)
    Windows 10 (64-bit)


    I'm currently working on a VR game for Google Cardboard.
    Previous version was made for Windows (Oculus and HTC HMD).

    1) When the player take a weapon, an UnityScript calls the Respawn function on another UnityScript :
    Code (JavaScript):
    1. public var Timer_sec : float = 5; //Timer en secondes
    2.  
    3. function Respawn (Numero : int, Pos : Vector3, Rot : Quaternion)
    4. {
    5.     //On attend la durée définie par Timer_sec
    6.     yield WaitForSeconds(Timer_sec);
    7.     //On fait apparaitre le Prefab à la position/rotation donnée
    8.     switch(Numero)
    9.     {
    10.         case 0 :
    11.             Instantiate(Prefab_WB_Bonus,Pos,Rot);
    12.             break;
    13.         case 1 :
    14.             Instantiate(Prefab_ProxBomb_Bonus,Pos,Rot);
    15.             break;
    16.         case 2 :
    17.             Instantiate(Prefab_Boule_Feu_Bonus,Pos,Rot);
    18.             break;
    19.         case 3 :
    20.             Instantiate(Prefab_Invulnerabilite,Pos,Rot);
    21.             break;
    22.         case 4 :
    23.             Instantiate(Prefab_Invisibilite,Pos,Rot);
    24.             break;
    25.         case 5 :
    26.             Instantiate(Prefab_Speed,Pos,Rot);
    27.             break;
    28.         default :
    29.             Debug.Log("Numéro de Prefab inconnu");
    30.             break;
    31.     }
    32. }
    It just wait forever at "yield WaitForSeconds(Timer_sec);"

    2) So I made that :
    Code (JavaScript):
    1. public var Timer_sec : float = 5; //Timer en secondes
    2.  
    3. function Respawn (Numero : int, Pos : Vector3, Rot : Quaternion)
    4. {
    5.     Respawn_CR(Numero, Pos, Rot);
    6. }
    7.  
    8.  
    9. function Respawn_CR (Numero : int, Pos : Vector3, Rot : Quaternion)
    10. {
    11.     //On attend la durée définie par Timer_sec
    12.     yield WaitForSeconds(Timer_sec);
    13.     //On fait apparaitre le Prefab à la position/rotation donnée
    14.     switch(Numero)
    15.     {
    16.         case 0 :
    17.             Instantiate(Prefab_WB_Bonus,Pos,Rot);
    18.             break;
    19.         case 1 :
    20.             Instantiate(Prefab_ProxBomb_Bonus,Pos,Rot);
    21.             break;
    22.         case 2 :
    23.             Instantiate(Prefab_Boule_Feu_Bonus,Pos,Rot);
    24.             break;
    25.         case 3 :
    26.             Instantiate(Prefab_Invulnerabilite,Pos,Rot);
    27.             break;
    28.         case 4 :
    29.             Instantiate(Prefab_Invisibilite,Pos,Rot);
    30.             break;
    31.         case 5 :
    32.             Instantiate(Prefab_Speed,Pos,Rot);
    33.             break;
    34.         default :
    35.             Debug.Log("Numéro de Prefab inconnu");
    36.             break;
    37.     }
    38. }
    And it works ...

    3) If I manually change the public var Timer_sec then take the weapon and stop playing in the editor, I have a fatal error : FatalError.png

    If anybody knows about that I'll be happy to read ;)
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Hey this is definitely a bug in Unity. Could we have a bug report with a repro attached?
     
  3. Protozoaire

    Protozoaire

    Joined:
    Apr 14, 2015
    Posts:
    61
    Done ;)
    Case number 787576.