edited October 2018 in ORK Support
I added a lot of images to my project, then build and run on my Android phone.
It crashes on startup. After check the Monitors in AndroidStudio, the memory usage is up to 1 GB.
Then I check the profiler in Unity, It seems like that the Unity load most of my assets to memory, but in my scene there just one background image and a few buttons. Most of the textures(not used in current scene but loaded to memory) are referenced by ORK.
Is this normal?

All of the assets/textures are NOT in the Resources folder.

Image and video hosting by TinyPic
Post edited by bitmore on
  • edited October 2018
    Here is my new test:
    I created a new clean project, didn't import ORK at the first, but import some textures. Set one of the images as scene background. Everything works fine, the profiler shows only one image was loaded.
    Image and video hosting by TinyPic

    Then I import ORK into the project, and set one icon as a combatant's avatar in ORK Editor. After that I didn't do anything. No ORK Starter in the scene, didn't spawn the combatant, didn't use the icon in the scene, the icon is totally UNUSED unless set as avatar in ORK Editor.
    After running the project, the profiler shows that icon was loaded. See the image below.
    Image and video hosting by TinyPic

    My ORK version is 2.17.0, I tested this both in Unity 2017.1.0f3 and Unity 2018.2.
    Post edited by bitmore on
  • In case you need the test project, I uploaded it to the Dropbox, here is the download link:
  • From Best Practices: Objects, Assets, and Serialization:
    When an Object is loaded, Unity tries to resolve any references by translating each reference's File GUID and Local ID into an Instance ID. An Object will be loaded on-demand the first time its Instance ID is dereferenced if two criteria are true:

    The Instance ID references an Object that is not currently loaded

    The Instance ID has a valid File GUID and Local ID registered in the cache

    This generally occurs very shortly after the reference itself is loaded and resolved.
    So when the ORKProject.asset is loaded, all object references are resolved and loaded at the same time. There isn't anything that you (personally) can do about it. So when that database is loaded, it also loads all images, prefabs, audio files, etc referenced anywhere in it.

    I can't find the post, but @gamingislove refers to this as a primary reason for moving to a new database structure for ORK v3 where each data item is stored as an individual .assset file (in other words, each data item class inherits from ScriptableObject).

    Please correct me if I'm wrong, GiL.
  • Yeah ... it's pretty much as @Keldryn said. This is a general issue with how Unity handles this stuff, as it loads everything that is connected with an asset when that asset is loaded.

    I hope to change this with the overall data structure changes coming in ORK 3 in the future. The only other way would be to go back to using the Resources folder as it was done in ORK 1, although Unity discourages from using that method :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove - Have you looked into the Unity Addressable Asset System yet?
    AssetReference - An object that operates like a direct reference, but with deferred initialization (for example, for lazy loading). The AssetReference stores the GUID as an addressable that you can load on-demand.

    Asynchronous Loading - allows the location of the Asset and dependencies (for example, local, remote and generated) to change throughout the course of your development without changing the game code. Async Loading is foundational to the Addressable Asset System.
    More on its forum thread.

    It's still at a "preview" state, and it will require Unity 2018.2 and up (well, it's distributed via the Package Manager; I haven't tried copying the code files into an older Unity version to see if they work there).
  • I've heard of it but didn't look into it yet - as it's still in preview and potentially not available on pre 2018 Unity versions it's currently not really an option :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited March 15
    I'm sorry to comment this old thread, but this is really a big problem now.
    My game has been published on App Store and Google Play Store for about a month, it turns out OK and I do earn some money on it.
    But due to this memory issue I got many one star reviews, users said the game crashes after the loading is finished(when the loading is 100% will load the scene has ORKStarter). It happens both on Android and iOS(iPhone6 and older).
    So is there any thing I can do to improve the performance of my game? I have tried reduce the resolution of textures, and using POT resolution, package the textures, using the recomended compression (ETC2 8 bits for Android and PVRTC 4 bits for iOS),etc.
    If using the Resources folder will work, is there any tutorial? Do I have to use ORK1?
    Any news for ORK3 by the way? I'm get used to ORK now, and my next game still consider using ORK system.
    Post edited by bitmore on
  • edited March 16
    I'm working on a solution using Resources folders, although Unity discourages using it, it should help with that issue. Ideally, the solution should allow you to just move assets (e.g. combatant prefabs) into a Resources folder and press a button in the ORK editor to update the references :)

    It'd help me a lot if you could test this with your game - please send me an email to contact@orkframework.com, I should be able to send you a beta version sometime next week.
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove This is really good news! I have sent you the email.
Sign In or Register to comment.