Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Easier debugging: compiling for 11_5 , a user guide

Discussion in 'Flash' started by jerome-lacoste, Jul 30, 2013.

  1. jerome-lacoste

    jerome-lacoste

    Joined:
    Jan 7, 2012
    Posts:
    206
    I am getting hard to reproduce crashes on our games. Asking the users to install the content debugger isn't very friendly.

    Now stack traces could be displayed without the need of the content debugger if Unity was able to support flash v11.5 or later. See http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Error.html#getStackTrace() for information

    It doesn't. But it can be made to. Here's a guide.

    But first here are the results

    Here's a test project. It's the test case for bug 554719, reproducible on chrome, not on Firefox (whatever the flash player version you use).

    Open https://dl.dropboxusercontent.com/u/116774/FlashCrash/Before/FlashMemoryReporting.html
    It causes https://dl.dropboxusercontent.com/u/116774/FlashCrash/Before/Crash.png

    Compare with https://dl.dropboxusercontent.com/u/116774/FlashCrash/After/FlashMemoryReporting.html
    It causes https://dl.dropboxusercontent.com/u/116774/FlashCrash/After/Crash.png

    Brief explanation of what to do if you want the same thing in your project.

    The code is https://github.com/lacostej/unity3d-flash-11_5
    The commit that does it all: https://github.com/lacostej/unity3d-flash-11_5/commit/8857af6b70ddb07b24012cd48f03979d50fe7700

    • fake support of 11_5 in unity flash libs
      cd $UNITY_HOME/Contents/PlaybackEngines/FlashSupport/BuildTools/flex/frameworks/libs/player/
      ln -s 11.4 11.5
    • build for flash and open your editor.log. Find the 2 last flash post processing operations (java and mono SwfPostProcessor.exe)
    • create a postprocessor script for flash that does the same as the above commands. You will need to edit it to

      • parametrize it (tip: use double quotes)
      • change target api (17 to 18 ) and flash 11_4 to 11_5 (assuming your were targeting 11.4 initially)
    • you also probably want to force 11.5 in the javascript line that loads your flash to make sure your clients work

      swfobject.registerObject("unityPlayer", "11.5.0");


    Note: I guess you lose Linux support (stuck at 11.2)

    This was tested on a Mac using Unity Pro.

    Note: it seems it would be very little effort for Unity to support flash 11_5 out of the box (hint! hint!)
     
  2. Cafe

    Cafe

    Joined:
    Jan 21, 2013
    Posts:
    21
    如果你是想解决因为www加载导致出来的内存泄露。最终swf奔溃的问题。那么可以使用unity调用as3 api:urlstream来加载bytes传给unity来处理,即可解决。
     
  3. RalphH

    RalphH

    Unity Technologies

    Joined:
    Dec 22, 2011
    Posts:
    592
    Thank you for providing this. Following your mention of why this is handy, we'll be adding support for Flash 11.5, 11.6, 11.7 and 11.8 to the Flash export in a future version of Unity.