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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Different behaviour in "Use Asset Database" than in other Play Mode Scripts

Discussion in 'Addressables' started by Gentlymad_Anselm, May 31, 2021.

  1. Gentlymad_Anselm

    Gentlymad_Anselm

    Joined:
    Sep 12, 2020
    Posts:
    3
    I am currently experiencing an issue where the "Use Asset Database" Play Mode Script behaves very differently from the two other Play Mode Scripts.

    When starting the game, I loop over all Addressables.ResourceLocators and scan the locations contained in there. In the "Use Existing Build" or "Simulate Groups" Play Mode Scripts, there are more assets contained in the returned list (some sub-assets show up there) and the ResourceType for the assets contains plausible data (eg. UnityEngine.GameObject, UnityEngine.Texture2D or custom classes).
    When using "Use Asset Database", there seem to be no sub-assets being listed and the ResourceType is always System.Object. Especially the latter is a problem as I need to treat different types of assets differently. I could work around the "missing" sub-assets but it would be nice if behaviour would be consistent.

    Is there something I am doing wrong here or is this a known limitation? And if it is a known limitation, is there some way to work around it?

    I just noticed that this does not happen is a small test project. There, at least the ResourceType seems correct.

    I am using Addressables version 1.16.19 with Unity 2019.4.21f1 (also tested it with package version 1.18.4, same behaviour there).
     
    Last edited: May 31, 2021
  2. Gentlymad_Anselm

    Gentlymad_Anselm

    Joined:
    Sep 12, 2020
    Posts:
    3
    It actually does happen in the small test project (I wanted to remove that line from the post above, but it complains about spam content and wouldn't let me).

    I attached the project to this post. Just load the SampleScene, run a groups-build, start the game with each Play Mode Scripts and look at the log.

    With "Use Existing Build" I get the following output:

    Assets/Prefabs/suzanne.prefab (UnityEngine.GameObject)
    Assets/Art/suzanne.fbx (UnityEngine.GameObject)
    Assets/Art/suzanne.fbx (UnityEngine.Mesh)
    Assets/Art/suzanne.mat (UnityEngine.Material)
    Assets/Art/suzanne_albedo.png (UnityEngine.Texture2D)

    Note, that suzanne.fbx is listed twice, once as a GameObject and once as a Mesh. This is what I would always expect to happen.

    With "Use Asset Database" I only get this:

    Assets/Prefabs/suzanne.prefab (System.Object)
    Assets/Art/suzanne.fbx (System.Object)
    Assets/Art/suzanne.mat (System.Object)
    Assets/Art/suzanne_albedo.png (System.Object)

    The suzanne.fbx is only listed once and the type for every object is System.Object.
     

    Attached Files:

    Last edited: May 31, 2021
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,798