Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Unity 3.5.2 live; with many fixes for Flash Preview

Discussion in 'Flash' started by RalphH, May 15, 2012.

  1. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    Hi all,

    You can get Unity 3.5.2 here; http://unity3d.com/unity/download/
    Especially for Flash preview users this will be a valuable update; while it's still in preview and by no means "finished", it does offer a pletora of fixes for Flash export.

    As new features, WWW and AssetBundles now work on Flash.

    Flash Changes:
    Flash: Has build targets for different FlashPlayer version 11.0, 11.1 and 11.2. No Flash Player version specific implementations exposed yet, but setting 11.2 means using a faster code path; better performance.
    Flash: www.GetAudioClip() now works, only for non streaming mp3's.
    Flash: WWW support
    Flash: WWWForm Support
    Flash: Assetbundle support

    Flash improvements;
    Flash: Introduced System.Attribute base type so custom attributes can at least compile cleanly.
    Flash: It's now possible to invoke constructors that declare byref parameters.
    Flash: Slightly faster Stage3D path and faster path implemented for 11.1 and 11.2 specific deploys.
    Flash: Point filtering now works.
    Flash: System.Bitconverter now works.
    Flash: Dictionary.ContainsValue now works.
    Flash: Smaller memory footprint in some cases
    Flash: Speedup in SWFPostProcessing
    Flash: performance optimizations on generated bytecode.
    Flash: Byte[] now has a Flash native bytearray as a backing store (.elements).
    Flash: Shallow implementation of System.Text.Encoding for ascii and utf
    Flash: Implementations of System.Random, System.IO.MemoryStream, DateTime.Today
    Flash: System.Exception.StackTrace property.
    Flash: more conversion errors include related source location now.

    Flash Fixes:
    Fixed crash when reloading scripts after launching Unity with a compile error.
    Flash: Fixed integer division semantics.
    Flash: Fixed memory leak in native methods returning structs.
    Flash: Fixed crash on constructors passing fields as byref arguments.
    Flash: Fixed RuntimeServices_ToBool_Object being invoked, but not implemented.
    Flash: Fixed endianness error on byte[].
    Flash: Fixed crashes on monobehaviour deserialization on asset bundles.
    Flash: Fixed particle system not being scriptable again.
    Flash: Fixed www.error being set to seemingly random strings, even if there was no eror.
    Flash: Fixed crashing on fatal errors on errors thrown in coroutines.
    Flash: Fixed fatal errors on www.texture access.
    Flash: Fixed flash preloader bar on black background.
    Flash: Fixed bug where array.CopyTo() fails if the destinationsize is larger than sourcesize.
    Flash: Fixed fields of type List crashing on Instantiate().
    Flash: Fixed serialization of List.
    Flash: Fixed multiple issues with SwfPostprocessor resulting in issues with swf not getting verified or causing stack under - or overflows.
    Flash: Many small actionscript conversion issues fixed.
    Flash: GuiTexture is rendering correctly again.
    Flash: Particles are rendering correctly again.
    Flash: Texture2D setPixels with larger textures doesn't crash anymore.
    Flash: UnityContent .setSize(width,height), working correctly.
    Flash: useGuiLayout works.
    Flash: No more crashes on gui.window.
    Flash: No more crashes on physics/charactercontroller collisions.
    Flash: Physics, fixed issues with objects shooting into space or being sticky.
    Flash: Array of Structs aren't being (incorrectly) serialized anymore.
    Flash: ParticleSystem now script accessible.
    Flash: Serialization of non-public monobehaviour now works.
    Flash: Issues with coroutines throwing FlashPlayer verify and stack size errors fixed.
    Flash: EncodeToPNG now works.
    Flash: Support for c# packing of array data in types.
    Flash: Correct handling of numeric casts of infix expressions (ex: (int)(f * g)).
    Flash: Fix serialization of List
    Flash: Fix SwfPostprocessor; cases where player was throwing fatal error indicating that files are not available / verifier error on constants.
    Flash: Fix SwfPostprocessor; fix max stack size calculation
    Flash: Fix WWW.GetAudioClip() usage in StartCoroutine crash.
     
  2. laurent-clave

    laurent-clave

    Joined:
    Jul 18, 2011
    Posts:
    280
    Thank you and congratulations for this new version;)
     
  3. Santisan

    Santisan

    Joined:
    May 15, 2012
    Posts:
    4
    When I export to flash with the new version, after the loading screen ends the screen goes all black.
    Here is the logfile
    I'm running flash player 11.2 debug version on Mac OSX 10.7.2
     
  4. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    @Santisan it looks like the swfpostprocessor has not been ran at all; your swf is missing it's files. However, with just the log I won't be able to reproduce, only identify a potential issue based on a symptom. Please file a bug report including your project file.
     
  5. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    thank you for the many bug fixes, and iOS improvements (hopefully a linux editor is coming soon ;-)
     
  6. laurent-clave

    laurent-clave

    Joined:
    Jul 18, 2011
    Posts:
    280
    same problem...
     
  7. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Thanks for new features and bug fixes. Can wait to test the new WWW and AssetBundles in Flash, Waiting for it for so long :)

    By the way, I have some graphics issues in Flash are still waiting to fix:

    1, "Realtime shadows work, but do get affected by bugs in image effect", it is in the "Flash: What is and is not supported" document already.
    Only turn on Realtime shadows works fine in Flash. but if i turn on both Realtime shadows + image effect has ugly affected shadows.

    2, After the Flash build, the Anti-Aliasing is not working from the "QualitySetting" from unity editor.
    Any alternative way to turn it on in Flash (need Action Script) ?

    I'm using Macbook air intel core2 duo, and OSX System 10.7.3
     
  8. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    1) Image Effects are really try and error, but mostly not expected to work; they are also not on the high priority list of fixing.

    2) Correct, a workaround is to set QualitySetting.AntiAliasing from a script in one of your monobehaviours, which will fix it.
     
  9. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    @darkloy; please submit a bug with your project.
     
  10. Santisan

    Santisan

    Joined:
    May 15, 2012
    Posts:
    4
    Done. Thanks
     
  11. TheArtfulMoogle

    TheArtfulMoogle

    Joined:
    Jul 22, 2011
    Posts:
    3
    Hi Ralph,

    Is there any fix for fog?
    I can't seem to get it working.

    I assume it is possible, as Tail Drift seems to be using it. (The far islands are slightly faded to blue).
     
  12. laurent-clave

    laurent-clave

    Joined:
    Jul 18, 2011
    Posts:
    280
    Same question for the fog ...
     
  13. TheArtfulMoogle

    TheArtfulMoogle

    Joined:
    Jul 22, 2011
    Posts:
    3
    Ah, I think he is using finalColor in a surface shader to make his own fog effect.
     
  14. laurent-clave

    laurent-clave

    Joined:
    Jul 18, 2011
    Posts:
    280
    You can tell me if it works please ?
     
  15. autonomous411

    autonomous411

    Joined:
    May 22, 2012
    Posts:
    9
    Is there a way to get access to the stage with this release? How can I do an addchild from a method in .as that I want to call from unity?
     
  16. ochalifoux

    ochalifoux

    Joined:
    Feb 20, 2012
    Posts:
    4
    Hi!

    I was waiting for a release with the AssetBundle support for Flash for quite some time now and I think it's great you managed to get this done! (Not surprised though! :D)

    I made some tests to see if I could get the AssetBundle example to work for the Flash Export and I managed to load a couple of things from the example. Seems to work well!

    I was wondering though if there's a way to dynamically load a Script file and link it to an object. I know you can actually do this for a standard project, but is it supported for Flash at the moment?

    My tests are not working... I end up with the following error message :
    "Error: Definition System.Reflection:Assembly could not be found."

    I'm guessing the "Assembly" type isn't supported yet, but wanted to be sure I wasn't missing something...

    Thanks in advance for the help!
     
  17. sandersnake

    sandersnake

    Joined:
    Nov 13, 2009
    Posts:
    11
    First of all big probs Ralph + team for being able to export all this great Unity3D stuff to the Flash Player!

    I played around with loading a GameObject (simple cube) from an Assetbundle but unfortunately without any luck.
    In the editor it works fine but the flash export will not load the gameobject from the bundle.

    Here's the coroutine code:
    Code (csharp):
    1.  
    2.     private string url                      = "http://actionscripter.nl/idu/avatar.unity3d";   
    3.     private WWW www;
    4.     private GameObject prefab;
    5.  
    6.     public Logger logger;
    7.    
    8.     void OnGUI(){              
    9.         GUILayout.BeginArea (new Rect(Screen.width-220, 20, 200, Screen.height-40));
    10.         GUILayout.BeginVertical(); 
    11.         if(GUILayout.Button("Load model")){                                    
    12.             www = new WWW(url);
    13.             StartCoroutine(Load());
    14.         }
    15.         GUILayout.EndVertical();
    16.         GUILayout.EndArea();
    17.     }
    18.  
    19.     IEnumerator Load() {
    20.         // Start a download of the given URL
    21.         logger.Add("start download");
    22.         // Wait for download to complete
    23.         yield return www;
    24.         logger.Add("download complete");
    25.         // Load and retrieve the AssetBundle
    26.         AssetBundle bundle = www.assetBundle;
    27.         logger.Add("load and retrieve assetbundle");
    28.         // Load the GameObject
    29.         GameObject go = bundle.Load("cube", typeof(GameObject)) as GameObject;
    30.         logger.Add("load gameobject");
    31.         // Instantiate the GameObject
    32.         prefab = Instantiate(go) as GameObject;
    33.         logger.Add("instantiate gameobject");
    34.     }
    35.  
    Demo available at:
    http://actionscripter.nl/idu/

    Am i missing something???
     
    Last edited: May 24, 2012
  18. ochalifoux

    ochalifoux

    Joined:
    Feb 20, 2012
    Posts:
    4
    Hey sandersnake,

    Looking at the errors my flash debugger showed me while running your example, I think the first thing you need to fix is the way you create your assets to be loaded.

    "The file can not be loaded because it was created for another build target that is not compatible with this platform."

    Using the AssetBundles example there is on the Unity site, you need to add a parameter in order to target the FlashPlayer.

    Code (csharp):
    1. BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("Assets/artwork/lerpzuv.tif"), null, "AssetBundles/Shared.swf", options, BuildTarget.FlashPlayer);
    Plus, you'll want to make sure you're exporting the bundle as a .swf file since it's the "native" format for Flash Player. (see above).

    So 2 important things :
    - .swf
    - BuildTarget.FlashPlayer

    That's the first things you'll need to fix to have a chance to make it work! :)

    Hope it helps!
    Good luck!
     
  19. Santisan

    Santisan

    Joined:
    May 15, 2012
    Posts:
    4
    I've sent the bug report, they told me they were able to reproduce it and were going to fix it.
    Is there any workaround to fix this issue in the meantime or I'll just have to wait until the new version comes out?
     
    Last edited: May 28, 2012
  20. sandersnake

    sandersnake

    Joined:
    Nov 13, 2009
    Posts:
    11
    Thx ochalifoux!
    Works like a charm!

    Preview available at:
    http://idu.quince.nl/demo/htc/

    Press "load model" top right to load the external model / swf
     
  21. Kolger

    Kolger

    Joined:
    Feb 25, 2012
    Posts:
    7
    First of all, awesome work! Im really glad to see that there's WWW support now! :D

    I am, however, struggling with some other classes which havent been implemented yet, and I'd like to know how high are they on the priorities list. They are:

    • XMLDocument / XMLNode / XMLElement
    • Encoding
    • Regex
    • LINQ

    The XML ones are the ones that matter the most to me, all the others I can live without. Just wondering if it's gonna be released anytime soon :)
    Thanks in advance!
     
  22. byocode

    byocode

    Joined:
    Jun 7, 2012
    Posts:
    7
    Glad too to see WWW support for Flash ;).

    However, I noticed that although calling the "Load" method on the assetbundle works -- i.e. assetBundle.Load(name : String) returns the object expected, but I notice that calling "LoadAsync" returns null. Note that "LoadAsync" works fine when I run the code inside the Unity editor, but returns null when I run it inside the browser.

    For example, if I call:
    I get the object expected when I run it as Flash in the browser

    but if I call:
    I get a null object, instead of a valid reference to AssetBundleRequest that I had expected when I run it as Flash in the browser (works fine inside Unity editor though).

    Has anyone had success getting LoadAsync working when using Flash in the browser?

    Note to others: I also found out that calling "Application.dataPath" in the browser with flash always returns a path as:
    -- so you may have to find an alternative to get the path until Unity adds this when using Flash in the browser.
     
  23. northman

    northman

    Joined:
    Feb 28, 2008
    Posts:
    144
    Hello,
    I found the function: WWW.LoadImageIntoTexture() still does not work on Flash version.
    Can Anyone help me?

    Thanks
     
  24. Kolger

    Kolger

    Joined:
    Feb 25, 2012
    Posts:
    7
    Sorry to insist, but are there any news on these matters? :)
     
  25. Stalker.23b

    Stalker.23b

    Joined:
    Jul 27, 2011
    Posts:
    7
    Can i use streaming scenes in Flash? Currently BuildPipeline.BuildStreamedSceneAssetBundle gives me "`System.IO.File' does not contain a definition for `WriteAllBytes'" error. Does it mean streaming scenes are not supported in Flash? Are they on roadmap?
     
  26. catburton

    catburton

    Joined:
    Mar 29, 2011
    Posts:
    43
    LoadAsync() is not supported for Flash export. Please use Load() for your project instead.
     
  27. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    Doing that works in the editor for me, but not in Flash. I’m on 3.5.2f2 and I have set 2x multisampling both in a script and individually for every Quality level. I still don’t get antialiasing in Flash. (I tested 4x as well.) I’m not doing anything special with the Flash or HTML—just the direct Build and Run.

    Thanks for any tips!
     
  28. RalphH

    RalphH

    Administrator

    Joined:
    Dec 22, 2011
    Posts:
    592
    Your system / gfx card might not be fully supported by Flash; in which case you wouldn't see anti-aliasing.
     
  29. Luckymouse

    Luckymouse

    Joined:
    Jan 31, 2010
    Posts:
    484
    Thanks for the Tips ochalifoux :D


    Setting the anti-aliasing by script is working fine for me, maybe as UnityRalph said that your hardware does not support it.
     
  30. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    Good thought—thanks. I’ll dig up other test machines. Any way I can determine the Flash anti-aliasing sys reqs for certain, or is that the kind of info known only to gnomes deep in the caves of Adobe?

    My machine is a 2011 Core i7 MacBook Air with Intel HD Graphics 3000.
     
  31. Morgan

    Morgan

    Joined:
    May 21, 2006
    Posts:
    1,223
    I’ve tested on 3 Macs now: a 2011 MacBook Pro 13”, my own 2011 Air 11”, and a 2008 aluminum iMac. None show any smoothing once I export to Flash.

    This code works in the editor--I can see the AA kick in:

    Code (csharp):
    1. function Start () {
    2.     QualitySettings.antiAliasing = 2;
    3. }
    Do I need to do something else as well?
     
  32. bharathi.y

    bharathi.y

    Joined:
    May 7, 2013
    Posts:
    1
    Hi
    I am getting error in the line below

    i = Mathf.PingPong((Time.deltaTime) * speed, 1);

    Error : Operator '*' cannot be used with a left hand side of type 'float' and a right hand side of type 'Object'.
    Kindly help me.
     
    Last edited: Mar 27, 2014