ex2D - the best 2D sprite solution for Unity [RELEASED]

Discussion in 'Assets and Asset Store' started by Wu Jie, Aug 24, 2011.

  1. wesllg

    wesllg

    New Member

    Joined:
    Jan 8, 2011
    Messages:
    18
    Hi JWU, thanks for the great tool.

    However I am currently experiencing an intermittent issue that may be related to the use of external version control (SVN in this case) and ex2D in the same project. I was chugging along using ex2D in a prototype project for quite a while. I then got my hands on a Pro license and decided to upload to a SVN repository. At that point, I started getting a lot of crashes as the project had to re-import all my settings. For the record, I was following the guide here:

    http://unity3d.com/support/documentation/Manual/ExternalVersionControlSystemSupport.html

    It appears that the re-import was crashing on two files, namely:

    .ex2D_AtlasDB.asset
    .ex2D_SpriteAnimationDB.asset

    I assume these two files hold animation and atlas data and should be under version control?

    After two failed boot attempts the third one work and now the project appears to be fine, but I recently had this happen quite a lot in another project also using SVN and ex2D. I'm not sure who is the culprit yet, ex2D or Unity.

    I can send you the project for testing if you like.

    Cheers
  2. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi wesllg,

    I think something wrong in .ex2D_AtlasDB when reimport, and I need more example to test this. But to change a project from non-svn to Pro SVN, you'd better delete .ex2D_AtlasDB.asset, .ex2D_SpriteAnimationDB.asset first. So the re-import will not crash (some people report this,too). After that, when open the project ex2D will help you create these files. Then you can add them to your source control.

    See your feedback!
  3. AizenSousuke

    AizenSousuke

    New Member

    Joined:
    Jul 10, 2010
    Messages:
    4
    I'd like to ask how to make a ex sprite font render a score by using codes to control? If it is possible. (The documentation doesn't help me :( )
  4. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi AizenSousuke,

    I think you can control the score by the following code:

    Code (csharp):
    1.  
    2. exSpriteFont spFont = GetComponent<exSpriteFont>();
    3. spFont.text = myScore.ToString();
    4.  
  5. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    jwu i found some more bugs working with Fonts:

    1 - I'm using all my fonts as single images, not in Atlas, I don't know why, but in my mind I can't use Font inside Atlas, so today i found the right way to put the fonts in Atlas, but when i do that with all my actual fonts, everything bug, in some way he don't find my old fonts to update my BitmapFontObject to use this Atlas Version of the font, the only way is recreate everysingle object again.

    2 - Everytime i update my atlas with some more stuff all my BitmapFontObject restar to start position. Like: Create one exBitmapFontObject, change the position for anywhere in screen, update the Atlas of this Font, the position of this object, reset!
  6. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277

    This bug 2, is because Layer2D is checked, sorry :p
  7. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi badawe,

    Is your first problem still exists? Can you show me a step by step way to reproduce it ?

    Thanks in advance.
  8. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    jwu i found the bug is when i create some font using a single bitmap atlas font, and when you put this bitmap font on Atlas, he crash and you have to remake every BitmapSprite Font.


    By now i get some strange errors, look at this:
    Code (csharp):
    1. The texture import settings of [Assets/Textures/Interface/ScoreScreen/sc_red_loose.png] is invalid for atlas build
    2. UnityEngine.Debug:LogError(Object)
    3. exAtlasInfoUtility:FillAtlasTexture(Texture2D, exAtlasInfo, Boolean)
    4. exAtlasInfoUtility:Build(exAtlasInfo, Boolean)
    5. ex2D_PostProcessor:OnPostprocessAllAssets(String[], String[], String[], String[])
    6. UnityEditor.AssetDatabase:ImportAsset(String, ImportAssetOptions)
    7. exTextureHelper:ImportTextureForAtlas(Texture2D)
    Code (csharp):
    1. InvalidOperationException: Collection was modified; enumeration operation may not execute.
    2. System.Collections.Generic.List`1+Enumerator[exAtlasInfo+Element].VerifyState ()
    3. System.Collections.Generic.List`1+Enumerator[exAtlasInfo+Element].MoveNext ()
    4. exAtlasInfoUtility.FillAtlasTexture (UnityEngine.Texture2D _tex, .exAtlasInfo _atlasInfo, Boolean _noImport)
    5. exAtlasInfoUtility.Build (.exAtlasInfo _atlasInfo, Boolean _noImport)
    6. exAtlasEditor.OnGUI ()
    Do you have any idea of what is going on?
  9. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    That means the texture settings of your bitmap font texture is not valid for importing. It should be the Read/Write settings of the texture didn't turn on.

    The document for creating an atlas font is here: http://www.ex-dev.com/ex2d/wiki/doku.php?id=manual:font_editor:create_atlas_font
    Just for sure, are you trying to drag a Bitmap Font Texture to Atlas ? You should drag the Bitmap Font Asset not the texture.
  10. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277

    For some reason i must re export from photoshop, and everything works!
  11. MaskedPixel

    MaskedPixel

    New Member

    Joined:
    Oct 14, 2011
    Messages:
    8
    I have an animation clip that I need to add a frame to at runtime.

    Trying:
    Code (csharp):
    1. animClip.frameInfos.Add(new exSpriteAnimClip.FrameInfo {atlas = atlas, index = atlas.GetIndexByName(e.name), textureGUID = e.name});
    This does not work. The Capacity of frameInfos increases, but the Count does not. The frame was not actually added. Is it possible to do this?

    I am currently testing out the Evaluation version if that makes a difference. So far, everything looks great as long as I can change an animation at run time.
  12. MaskedPixel

    MaskedPixel

    New Member

    Joined:
    Oct 14, 2011
    Messages:
    8
    Disregard that previous post. I had been staring at the same code for 3 hours when it turns out I just needed to walk away. I was creating the new animation clip in the for loop I was using to add the frames.
  13. thechest4

    thechest4

    New Member

    Joined:
    Oct 13, 2011
    Messages:
    9
  14. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi thechest4,

    I notice that you are using pixel perfect for your background. In ex2D v1.2.0, the pixel perfect is use the current screen resolution, and if you are using 800x1000 but your game window didn't expand to that size, the pixel perfect calculation will not calculate correctly.

    However, we've solve the problem by providing customize width and height in pixel perfect camera component in ex2D v1.2.1.
    I'm submitting the v1.2.1 to asset store.

    For now, just make sure your window is larger than 800x1000 and wait for the new version :)
  15. thechest4

    thechest4

    New Member

    Joined:
    Oct 13, 2011
    Messages:
    9
    Oh okay thanks for the quick response! Do you know how long until 1.2.1 will be available?
  16. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    We plan to release it today. But looks like asset store have problem recently, I just can't access it. If everything goes correctly, it will be on the store tomorrow.
  17. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    ex2D 1.2.1 is available for download in Asset Store! Go grab it now, changelist will be updated soon.
  18. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Guys! One big thing we have with ex2D is the exGroupImporter!
    I'm using this for everything, but one thing i check right now is:

    When apply with AudioClips he only get the Audio Format! Other options not!

    Do you guys mind put that on exGroupImporter?
  19. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    yeah that doesn't work on some properties in AudioClips..
    It's a shame but seems like we are not able to get that changed through script.

    Wait for jwu to confirm this.
  20. thechest4

    thechest4

    New Member

    Joined:
    Oct 13, 2011
    Messages:
    9
    Hi guys, the new version fixed my previous issue with the background not rendering fully, so thanks for that!

    However now I am trying to use the mouseposition to generate objects within the grid, however it seems that my background has been scaled down (or at least does not match up to unity units)! Each of the squares in the grid is supposed to be 50px by 50px, for a total screen size of 800px by 1000px, however in the attached image I have marked the location of mouseposition 0,0 (blue dot, lower left corner) and mouseposition 800,1000 (red dot, near pause button). As you can see, what should be the top right corner of my texture is actually off of the screen!

    What is going on here? I am now using the Custom Size feature to set my background sprite to 800 width 1000 height, and I am also using the same settings on the camera. Is there some way I can get the mouseposition to map 1:1 with the pixels in my textures? Thanks!

    http://img820.imageshack.us/img820/9638/incorrectmouseposition.png
  21. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi thechest4,

    It is because you are using a viewport larger than your Game View. So for grid based game, if you would like the grid scale to fit the viewport, I only find 2 solution:

    1. Drag the Game View window out and make it larger than the 800 x 1000 size in your screen

    or

    2. Disable custom size let the pixel perfect fit your Game View.

    Hope this help you.
  22. thechest4

    thechest4

    New Member

    Joined:
    Oct 13, 2011
    Messages:
    9
    jwu you are the man :)
  23. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi badawe,

    Sorry I forget to confirm this. Yes, the Unity give us less choice in audio-clip settings by script. So we can't change the audio format by script in current version of Unity.
    Last edited: Oct 19, 2011
  24. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    ex2D v1.2.1 is available for download in Asset Store!

    IMPORTANT: As the ex2D become stable, we are going to increase the price to $35 in next month (2011.11.15).
  25. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Hey guys,

    I've added new videos in the first page, introduction of ex2D new features and changes of 1.1.0-1.2.1

    go to the first page and check it out!
  26. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    @nantas and @jwt!

    First of all I want to thank you guys, for the incredible work you guys do since the beta, and to this last version.
    I think ex2D is the best solution so far over Assets Store, and i look all of then!

    Some things I'm really expect see in further versions.

    - Working with ex2D with Asset Store, really needs a review, every time someone add one thing in one Atlas, everything bugs, very hard!
    - Sometimes the one scene of project bugs and make everything 8 bits like this:
    [​IMG]
    the only thing can solve that: is delete the entire project, and download from Asset Server again back to that:
    [​IMG]

    - The fonts, like the last, everytime something have been added to project, all fonts crash.
    [​IMG]
    to solve that, must delete Atlas DB / Recreate / Rebuid Scene Sprite:
    [​IMG]

    - Another thing is the prefabs, everytime you change something in Atlas, you must search for every prefab in game, and do a rebuild!

    I think the principal problem, of ex2D is working with another computers with Asset Store or SVN, and i really before start a new project want to think about what is the best way to do this things.

    Maybe only edit Atlas over one MAC? What you guys think?
    Last edited: Oct 20, 2011
  27. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi Badawe,

    The 8bit like scene and error font display is caused by wrong index of your texture in atlas DB. This may happend such as some one add things in one atlas and upload to asset server, but never upload the atlasDB, and when you downloaded his atlas, it use your local atlasDB to index it. Then everything goes wrong.

    You can solve this by sync your project from asset server, then click sync button in your AtlasDB inspector. Then don't forget to press ctrl/command + alt + b to rebuild every scene in your project.

    You also can solve this by putting the atlas DB to source control, and when sync asset the changes of the atlas DB in others.

    For the prefab, when you change something in prefab, you need to open the scenes, and press ctrl/command + atl + b to rebuild the scene. We didn't find Unity3D provide script to rebuild scene without loading it. So this can be a disadvantage of ex2D that working with prefab.

    We will keep finding better way to solve this problem.
    Last edited: Oct 21, 2011
  28. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    So the best way is never upload the AtlasDB? Because every time we sync and build all / rebuild scene sprites give us some bugs in anywhere!

    Its just a thing i think you guys must think about! Nothing we can't workaround!
  29. mtthwjhnsn76

    mtthwjhnsn76

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    Hi guys,

    Having an issue with updating scene sprites (Ctrl+Alt+B command) and any ex2D sprites with mesh colliders lose the mesh collider in the scene. It is still attached to the prefab, but all the instances in the scene lose their mesh.

    So when I update the sprites, all the gameObjects in the scene become broken!

    Any way to avoid this when updating the scene sprites and any way to fix this on a large amount of gameObject instances we have already?

    Thanks.

    Matt -
  30. AdamSurfari

    AdamSurfari

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    How is the performance in iOS and Android?

    Can you send me example or apk files for me to run?
  31. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi Badawe,

    Sorry for the late reply. So let me explain more about AtlasDB and why sometimes working together will have bug.

    AtlasDB is a data structure that saves as a binary asset in Unity3D. It stores the texture to atlas index so that ex2D can found if a texture is in atlas and determine to use atlas rendering sprite or not.

    When you add, remove or move a texture from/to atlas, the atlasDB will update the index in it. And when you upload these changes, and download it from other computer, they should make sure the atlasDB is the same.

    But sometimes two people may changes atlas in different place and upload them at the same time. Since atlasDB is a binary asset, it can not be merged and at the end you can only accept one of the changes. That is why sometime you download things and lose information.

    Since this is the problem, every time you download the project, you should sync the AtlasDB and rebuild the scene. Or you should make sure that only one people manage the altas.

    Unity3D 3.5 provide a text asset format which is a good news for merge working flow. So if v3.5 release as it promise, the AtlasDB will become a text format asset and in that time, you are free to change atlas!

    Hope this can help you, and I'm looking forward to see what v3.5 can do. (if not, I still can try something such as save it as xml and load the DB when project opens.)
    Last edited: Oct 23, 2011
  32. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi Matt,

    I'll go check this problem.

    BTW: Can you tell me which version of ex2D you are using? Cause recently we solve some problem relate with mesh collider but it is new in v1.2.1 and we still don't have time to update the evaluate version (v1.2.0)
  33. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello AdamSurfari,

    ex2D provide an evaluate version, which can be downloaded in this page http://www.ex-dev.com/ex2d/beta.html. The evaluate version provide some example and can be build in iOS and Android device. So I think you are free to use it in any purpose.
  34. mtthwjhnsn76

    mtthwjhnsn76

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    Yeah, we are using v.1.2.0. Any idea to update all the instances back to the prefab state? Still show the blue connection to the prefab, but they are obviously different since the mesh is not connected.

    Looking forward to your findings!

    Matt -
  35. mtthwjhnsn76

    mtthwjhnsn76

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    So how can I control the Atlas DB so when anyone else gets it, it has my updates? Seems like they can get my version but it doesn't update the sprites if I modify the atlas and then rebuild it and rebuild the scene sprites. We are using the Asset Server, so they are getting my latest changes from that.

    Matt -
  36. AdamSurfari

    AdamSurfari

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    Thanks for your reply.

    Did you create Sheep Tap with ex2D?

    I ask because I need to have a similar amount of large number of characters on screen, and I would like to make sure that the tool I pick can handle that. Thanks
  37. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi Matt,

    You can roll back to prefab by click the revert button in the inspector of the prefab instance. After that if the sprite still not roll back to the original state, try ctrl/command + alt + b to rebuild it.

    To control Atlas DB, in current version you can make sure only one people manage atlas textures or you can click Sync button in the AtlasDB inspector after each time you update your project.
  38. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi AdamSurfari,

    Sheep Tap is made before ex2D. We use Sprite Manager 2 in this project. After that, we found lots of problem working with SM2, then we decide to build an easy tool and that is ex2D.

    We did some test including performance testing of original Sheep Tap, and it works well with ex2D. The performance actually is better than SM2. Not just the sprite number also the garbage collection times. In short, with ex2D our heap will not keep increasing and the frame rate is stable at 60fps.
  39. mtthwjhnsn76

    mtthwjhnsn76

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    This was what kept causing us issues was when we used the ctrl+alt+b hotkey - making us lose the mesh in our mesh collider. I believe we have found a fix in v.1.2.1 though.


    So sync will update the Atlas but not rebuild it? Makes sense I guess.

    Matt -
  40. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704

    1. so you've tested the problem in v1.2.1? I still can't reproduce it.

    2. Yes sync will update the atlas mapping index, but never rebuild the scene or rebuild the atlas. (that's why we have Rebuild All button under "Sync")
  41. mtthwjhnsn76

    mtthwjhnsn76

    New Member

    Joined:
    Oct 22, 2011
    Messages:
    5
    Yeah I tested in v1.2.1 on my home pc, and it doesn't seem to happen. I will get them to update to the same version at my work and see if this fixes it.

    Good to know about sync instead of rebuild.

    Thanks for the help guys, and keep going! Excited for the possible new features coming.

    Matt -
  42. Lisan

    Lisan

    Member

    Joined:
    Jun 17, 2009
    Messages:
    124
    Hi jwu,

    First, i have the question. I develop iOs application that used large amount of large atlases (2048x2048). They can't be compressed to PVRTC, because they are containing animation frames, and animation is not looking good with compression. But without compression app size is too big. I think about using AssetBundles for that, because they are compressed externaly, but i'm not sure, how properly use Asset Bundles loading with ex2D. Let's say, i have one exSpriteAnimation gameObject, that contains 18 animations and use 4 atlases for them. But only one atlas assigned directly to component, other is found via reference in DB asset, right? So question is - how do i load atlases from Asset bundles properly, so they can be accesable by ex2D? I will load and assign 1 atlas to component, but what should i do with another 3 atlases?

    Second, the issue. I'm using 1.2.0 version currently, and Unity crashes on every update i download from Asset Server. It downloads assets, then get haged on "Sync" window, and then crashes. It happens on PC every time (to fight it i have to create new project and download all from the scratch, this way it don't have to sync anything, so it works) In my Mac it also happens, but rarely, only couple of times.

    Third, the advice. When atlas is created or edited, you leave "Read/Write Enabled" setting switched on. This way texture takes double amount of memory (2048x2048 atlas is 16Mb, and it takes 32Mb in iPad memory then running app). It will be greate to switch it off after atlas creation, for thouse who don't know or just forget about it.

    Thanks in advance!
  43. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello Lisan,

    Let me answer your questions:

    ex2D support multi-atlas animation. It is saved in the FrameInfo in exSpriteAnimation component as Index and Atlas reference. So I think you can just include the 4 atlas, and in the game, the sprite animation component knowns to switch atlas by itself when playing.

    We didn't use Asset Server yet. We are going to use it in next few month. And the mainly working environment in our team is in Mac. We also receive crash report in Windows by other customer. I'm still working hard to find the reason. It looks like sometimes import texture and import atlas are conflict with AtlasDB. I can't give you an answer now, but once I install Asset Server, I will do a full test in both Windows and Mac. (and ex2D v1.2.1 have adjust some code in importing so may be you can try it later)

    Are you sure? This is a big news for me today. I've ask people around, but they don't give me a certain answer of what is the different between Read/Write enable and disable. So if this is true, ex2D should respond in disable Read/Write for atlas texture! And many thanks for this information! By the way, where can i find documentation in discussing this issue ?

    Thank you for your feedback.
    Just let you know, if you would like an emergency fix service, you can join our ex2D daily build distribution. Just send me the Email including the Invoice Number of ex2D in asset store and your purpose, then we can send you the latest version for testing.

    Regards,
    Wu
    Last edited: Oct 25, 2011
  44. ecma262

    ecma262

    New Member

    Joined:
    Oct 25, 2011
    Messages:
    2
    Hi there!

    I have a question regarding aspect ratios support in ex2D. I am targeting Macs and PCs. I need to deal with all different kinds of aspect ratios while maintaining pixel perfect images. What is the recommended way of doing this in ex2D? I saw a few posts about targeting different platforms but my question is a bit different. For me, it is okay if the game world shows more objects for users with wide screens (16:10).

    Should I adjust the orthographic camera size according to the screen height at the beginning of the game? Any recommendation will be greatly appreciated.
  45. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi ecma262,

    You can do this by use pixel perfect option in exSprite inspector. And if you want a fix resolution, just fill the resolution in your Camera in the exPixelPerfecCamera component (will automatically added when use pixel perfect is enabled).

    More details, read: http://www.ex-dev.com/ex2d/wiki/doku.php?id=manual:advance:pixel_perfect_usage
  46. ecma262

    ecma262

    New Member

    Joined:
    Oct 25, 2011
    Messages:
    2
    Hi jwu:

    Thanks for the prompt response. I happened to read the wiki page that you provided. I also looked at the source code for the exPixelPerfectCamera https://github.com/jwu/ex2D_Runtime/blob/master/ex2D/Core/Component/Camera/exPixelPerfectCamera.cs and I can see that the 'MakePixelPerfect' method does this by scaling the sprite.

    I think the solution of adjusting the orthographic camera size at the beginning of the game so that it is half the height of the screen (assuming the main camera is covering the whole view port) is probably what I should go for.

    Using the pixel perfect option that you suggested has a drawback, as far as I can tell. The drawback is that by scaling the sprites you might introduce more gaps between objects. For example, say that I have 5 different boxes (game objects) sitting next to each other without any gaps. Lets assume that we did that for a camera size of 384 with the editor in a monitor with aspect ratio of 4:3. If we run the same game for a screen with aspect ratio of 16:10, we will see gaps between the boxes because each one of them has been scaled. I might have completely missed the point, just let me know if that is the case.

    Thanks
  47. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Yes, you are right.
    For me I prefer use orthographic camera and use half height to get pixel perfect. In my point of view, pixel perfect is design good for GUI element for 2D + 3D game. We seldom use it in pure 2D game so if you have different resolution, think about adjust the orthographic size of the camera to fit different viewport and build it. Hope this help you.
  48. Lisan

    Lisan

    Member

    Joined:
    Jun 17, 2009
    Messages:
    124
    Still don't understand. When i use AssetBundle.Load() i get thouse atlases as objects in code variable. How your component can address them, if i dont instantiate them or assign somethere?

    Thank you, i will try it.

    Yes, i'm sure. When i first tried to launch created scene on ipad, it just took all available memory and crashed. Then i started investigation, and found this post:
    http://forum.unity3d.com/threads/92983-Crash-during-Level-Load-on-the-iPad
    After it i created empty scene, and start experimenting with this setting, monitoring memory usage in Xcode Activity Monitor, and indeed, that's true.

    Ok, thanks!
  49. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Ok, so here is what ex2D do for sprite animation. The asset called exSpriteAnimClip, and it contains a frameInfo list. The structure of the FrameInfo is like this:

    Code (csharp):
    1.  
    2.     [System.Serializable]
    3.     public class FrameInfo {
    4.         public string textureGUID = ""; ///< the guid of the referenced texture
    5.         public float length = 0.0f;     ///< the length of the frame in seconds
    6.         public exAtlas atlas;           ///< the atlas used in this frame
    7.         public int index;               ///< the index of the atlas used in this frame
    8.     }
    9.  
    So as you can see, each frame contains the atlas and index and saved in exSpriteAnimClip. When you play the sprite animation, it will first check the time and get the FrameInfo, then it will call exSprite.SetSprite ( frameInfo.atlas, frameInfo.index ); to set the correct sprite by atlas and index.

    So if you create an asset bundle, when you loading it (LoadAll ?), all the atlas can be referenced again by exSpriteAnimClip isn't it ? And then you can Play() the animation without setup anything I guess.
  50. Lisan

    Lisan

    Member

    Joined:
    Jun 17, 2009
    Messages:
    124
    But this reference in FrameInfo, type of exAtlas, it should be created somehow when project initialized? This is the simple reference if atlas is in assets folder. But when using AssetBundles, atlas is not present in the build when component created, so this reference will be null. Or maybe it won't be null, and atlas anyway will be included in the build due to this reference? In that case whole point of using asset bundles is lost, because they are needed to externalize assets, so they are not in build and can be compressed externally.