Search Unity

Flash error - PlayerLoop called recursively

Discussion in 'Flash' started by Bloodfoxx, Jan 2, 2012.

  1. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    hello, i have been working on my first game in unity, and today i tried to build it to flash. i managed to fix some of the code so it built out without errors, but when i try to play the html file it just shows a blank white screen, while the flashlog.txt shows some errors,

    PlayerLoop called recursively!
    LogCallStackError
    at com.unity::UnityNative$/Ext_Flash_LogCallstack()
    at com.unity::UnityNative$/_Z17DebugStringToFilePKciS0_iiii()
    at com.unity::UnityNative$/_Z10PlayerLoopbb()
    at com.unity::UnityNative$/NativeExt_PlayerLoop()
    at com.unity::UnityContentInternal/playerLoop()
    at com.unity::UnityContent/onEnterFrame()
    PlayerLoop called recursively!

    (Filename: C:/BuildAgent/work/b0bcff80449a48aa/Runtime/Misc/Player.cpp Line: 1217)

    this is repeated many times. If anyone could help me fix this, that would be awesome :D
    (I am very new to both unity and programming in general, so this could be a simple thing that i am missing)
     
  2. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    440
  3. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    i dont think that is my problem, as i am not using sprite manager and as far as i can remember im not using any arrays either
     
  4. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    440
    The only other thing I could deduce is that its probably related to something Flash exporter is not currently supporting, based on what triggered it for me. Have you tried adding some Debug.Log's to see when the loop starts happening?
     
  5. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    ill try that now
     
  6. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    ok, ive been testing stuff and im pretty sure this is one of the bits of code causing the problem, as the Debug.Log("calljet") line is called just before the errors occur


    Code (csharp):
    1.     IEnumerator calljet(){
    2.         Debug.Log("calljetstarting");
    3.         yield return new WaitForSeconds(10);
    4.     while(level < 50){
    5.             Jetchance = 10 + level *1.5f;
    6.             random = Random.Range(0,100);
    7.             if(random <= Jetchance){
    8.                 Debug.Log("calljet");
    9.                 Instantiate(Jetwarning, new Vector3(0, 64.57f,50), Quaternion.Euler(-90,0,0));
    10.                 yield return new WaitForSeconds(3);
    11.                 Instantiate(Jet, new Vector3(196, 68,50), Quaternion.Euler(0, 270,0));
    12.                 yield return new WaitForSeconds (Random.Range(10,30));
    13.                
    14.             }else{
    15.                 yield return new WaitForSeconds (2);
    16.             }
    17.         }
    18.        
    19.        
    20.     }
    does anyone know why this causes the flash player to crash?
     
  7. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    There are some cases where our error reporting fails horribly. When you see "PlayerLoop entered recursively", what it means is that the frame before "something" went wrong horribly, and that frame never finished.

    Investigating these problems is annoying, but one way to do it is to enter this right before when you suspect something bad happens:

    FlashHelper.EmitAsm("UnityNative.startDeepTrace();");

    That will cause every method invocation (including the ones in the engine itself), to be logged to flashlog.txt (causing everything to come to a craaaaaaaaaaaaaawl), but often does result in a log of calls that gives you a good hint of exactly where it goes boink. I'd say try that, and if you can't make heads or tails from the log put it online somewhere with a link here and I'll take a look.
     
  8. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    738
    I had a similar issue,

    i was getting the player loop recursive bug when inside of a loop of a Dictionary, and i was at say number 62 key entry, and when i tried to access that 62 using DictionaryHere[pair.key].MyPropertiesHere

    it would cause the error

    instead i had to call pair.value.MyPropertiesHere

    which IS better, however what i was doing before was not recursive and thats a horrible bug that they should fix. this only occurs in the Flash Export version, works fine in editor and web player.
     
  9. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    i added FlashHelper.EmitAsm("UnityNative.startDeepTrace(); "); to my code, but it gives an error when i build the game to flash
     
  10. Bloodfoxx

    Bloodfoxx

    Joined:
    Aug 13, 2011
    Posts:
    6
    i did a bug report on this, case number 436346
     
  11. chronald

    chronald

    Joined:
    Jan 3, 2012
    Posts:
    3
    Mine breaks while using UnityEngine.Random.Range

    I mean really, first System.Random doesn't work, and now Random.Range doesn't?

    What do they want for this contest? Obviously nothing randomly generated.