Search Unity

MissingMethodException

Discussion in 'Addressables' started by ELaino, Aug 31, 2019.

  1. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    I'm integrating the addressables system in my project.

    In the editor all works fine, but when I build from iOS and I try to load an addressable I get this error:

    Code (CSharp):
    1. Non-fatal Exception: MissingMethodException
    2. Default constructor not found for type UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
    3.  
    Unity version: 2018.3
    Addressables version: 1.1.10

    N.B.
    I've tried disabling String Engind Code, bit nothing changed
     
    mandisaw and lanpartygamesstudio like this.
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Looks like you haven’t run build player content.
     
  3. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    I've built player content on my local machine, but the game build is made on cloud build, so the build path would not match.
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
  5. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    Thanks Favo-Yang.
    But rebuilding addressables for each build will create a new cachedata.bin every time and this could be a problem.
    I'll try to explain:

    In my game you can play on different arenas.
    By using addressables system, I make those arenas downloadable from server.
    I realese the game version 1.0 with 10 arenas and a cachedata.bin is generated.
    I realese the game version 2.0 with the same arenas and a new cachedata.bin is generated.
    If I want to add 1 or more arenas downloadable from my server, do I have to rebuild player content both with cachedata.bin generated for version 1.0 and 2.0?
     
  6. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    Ok, I just builded from cloud build and I noticed that I cannot download cachedata.bin, so it's not possibile to make a content update?
     
  7. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Two questions here.

    The first one is how to separate build player content (addressable assets) and build app binary to different machines, which hopefully solved by the threads I mentioned. It majorly benefits bigger project that have dedicated dev to build assets, and other devs just consume built assets from a content server. Let unity cloud build server do the dirty work also a workaround, since it actually build assets and app binary from the same machine.

    The second one is how to do a proper content update. But that's for production releases.

    No, you don't. In your example,
    • 1.0 build player content, generates a 1.0.bin file and a few bundles.
    • 2.0 build for content update (using 1.0.bin), generates a 2.0.bin file, a content-update.bundle for static content and perhaps new bundles for dynamic contents.
    • 3.0 build for content update (using 2.0.bin), generates a 3.0.bin and a content-update-1.bundle for static content and perhaps new bundles for dynamic contents.
    • Then,
    • 1.0 end user will fetch the latest catalog file and get all new bundles from 2.0, 3.0 updates.
    • 2.0 end user will fetch the latest catalog file and get new bundles from 3.0 updates.
     
    BobFlame likes this.
  8. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    It can be a feature request. Without the ability to export built assets from unity cloud machine, the feature is limited to build local content only. If you have time you can explore the post-export method to upload your content to server using sync io.
     
  9. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    Thanks again for both the answers.
    I solved the MissingMethodException by following your solution for building app binary and player content on different machines.
    But now I'm getting another error while trying to load remote assets:

    Exception encountered in operation Resource<GameObject>(MyPrefab.prefab): Unable to load dependent bundle from location: Assets/MyCompany/Prefabs/MyPrefab.prefab
    UnityEngine.ResourceManagement,AsyncOperations.AsyncOperationBase'1:InvokeExecute()
    ....


    This is the client code:
    Code (CSharp):
    1.     public async static Task<TObject> LoadAsset<TObject>(object key)
    2.     {
    3.         BLog.Log($"[AddressablesManager] LoadAsset key: {key} type: {typeof(TObject)}");
    4.  
    5.         var op = Addressables.LoadAssetAsync<TObject>(key);
    6.  
    7.         await op.Task;
    8.  
    9.         if (op.Result == null)
    10.         {
    11.             var message = "Sync LoadAsset has null result " + key;
    12.             if (op.OperationException != null)
    13.                 message += " Exception: " + op.OperationException;
    14.  
    15.             throw new Exception(message);
    16.         }
    17.  
    18.         return op.Result;
    19.     }
    I cannot understand from the error message where is the problem, if the server address is not reachable or if the player content has not builded properly or something else.

    N.B.
    While building app binary from my machine the assets are correctly loaded.
     
    Last edited: Sep 2, 2019
  10. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    I don't know what happens, the message means the system can not find bundle the location is depended. Maybe you can debug BundledAssetProvider.cs, around line 49, to figure out why. And you may want to test Fast Mode, Packed Mode see if any differences.

    upload_2019-9-2_20-46-39.png
     
  11. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    Thanks again for your patience.
    I think the problem was that the cloud build cache stored some addressables stuff from the previous build (in which I builded also the player content) into the Library folder.
    So, making a clean build the MissingMethodException is back.

    I think I'm missing something in your work around for building player content on a different machine.

    This is my setup:
    • BuildPath : Addressables/v1/[BuildTarget]
    • Build Remote Catalog is true
    • Player version override is 1
    • Bundle Mode is pack separately
    • Bundle naming is No Hash
    • Static content is false
    • Bundle Asset Provider Type is AssetBundleProvider
    • Build Script is PackedMode

    This is what I do:

    1) Build Player Content on my local machine
    2) Push the builded player content folder (ProjectRoot/Addressables) to git
    3a) Build the game binary with cloud build (without rebuilding Player Content)
    3b) Build the game binary locally

    The local binary (3b) perfectly load the bundles, the one builded with cloud (3a) gives MissingMethodException.

    I'm missing something?
     
  12. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    I assume this is the RemoteBuildPath.

    Your setup looks ok, except you haven't mentioned whether the Library/com.unity.addressables/StreamingAssesCopy is included in your repo. Those files will be copied into StreamingAssets folder during build process (see AddressablesPlayerBuildProcessor.cs). Without those setting files, the AAS won't know where to load.

    If you try deleting that folder and then build locally, probably you can reproduce the issue happens on cloud.

    upload_2019-9-4_17-17-32.png

    See step 3 in
    https://forum.unity.com/threads/building-player-but-not-rebuild-player-content.735146/#post-4909202
     
  13. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    No, this is the local build path, in the same directory of the Assets folder. Then I move the bundles manually on AWS.

    Ok, I missed that part!
    It's not so cool because the library folder is in the .gitignore, but I've unignored it with
    !/*/Library/com.unity.addressables


    I added this step, but still cant load assets.

    I get this error:

    Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[UnityEngine.GameObject], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=VoiceController ENG


    and seems that one file is missing in the StreamingAssetsCopy
    Senza nome.png
     
  14. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Could you make a screenshot of your settings file?

    LocalBuildPath is by default the Library/com.unity.addressables, which stores settings file and local bundles. It probably should remain no changes for most projects.

    RemoteBuildPath is the path of remote bundles and catalog file, which intend to upload to your content server.

    Since you changed the local path to Addressables/v1/[BuildTarget], you shall commit that folder instead, (or just revert back to `[UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]`. Please notice again this is just for setting files and local bundles.
     
  15. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    The path Addressables/v1/[BuildTarget] is in the Project root, so it's committed.
    Those are my settings:
     

    Attached Files:

  16. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    Adding the ADDRESSABLES_LOG_ALL define symbol I get this log at the app start (only while building from cloud):


    Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].

    UnityEngine.AddressableAssets.Initialization.InitializationOperation:Execute()

    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:InvokeExecute()

    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Start(ResourceManager, AsyncOperationHandle, DelegateList`1)

    UnityEngine.ResourceManagement.ResourceManager:StartOperation(AsyncOperationBase`1, AsyncOperationHandle)

    UnityEngine.AddressableAssets.AddressablesImpl:InitializeAsync(String, String)

    UnityEngine.AddressableAssets.AddressablesImpl:InitializeAsync()

    AddressablesManager:Init()


    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)


     
  17. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    Summary of your screenshots
    - Default local group is configured as a remote group
    - RemoteBuildPath located at ServerData/...
    - LocalBuildPath remains no change.

    I have a similar setup and delete ServerData and Library/com.unity.addressables folder before a clean build. Then build content.
    upload_2019-9-5_21-54-0.png

    ServerData shall upload to content server.
    Library/com.unity.addressables shall commit into repo except the bin file which is unnecessary.

    Now clone a clean repo (to emulate a cloud build), the repo contains settings file (Library/com.unity.addressables), and does not have the ServerData folder. You can run with packed player mode in editor, or build an app binary to test out.
     
  18. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    You may also want to enable full log to see any strange thing happens.

    ADDRESSABLES_LOG_ALL

    upload_2019-9-5_22-22-0.png
     
    MuntyMcFly likes this.
  19. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    The log means the system failed to load your settings file. Any clues how it happens?

    Based on the logic of AddressablesPlayerBuildProcessor.cs, you should find the text of "
    Copying Addressables data from {0} to {1}. These copies will be deleted at the e..." in your cloud build log.

    Because testing on cloud build can be very frustrating because of the slow process, I highly suggest you follow #17 to emulate the cloud build with a clean repo.
     
  20. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    I downloaded a clean repo of my project and I think that the problem can be that the selected Play Mode Script is not synced.
    In my original repo the play script mode is set to packed, in the "clean repo" is set do fast and while I change it I cannot see any diff in git.
     
    Last edited: Sep 10, 2019
  21. ELaino

    ELaino

    Joined:
    Nov 2, 2017
    Posts:
    17
    My solution:
    -Build player content locally
    -Upload builded player content to the host service
    -Push player content (also Library stuff)
    -Rebuild Addressables from cloud build while building app binary

    With this pipeline I can update my player content from the .bin unity generates in the local build.
     
  22. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    I don't know whether it's what you want to achieve. But I'm glad you find a workaround.