Search Unity

"Scene asset can not be used" error but I don't know of any scene asset

Discussion in 'Addressables' started by TilmanAtChatterbug, Jul 7, 2020.

  1. TilmanAtChatterbug

    TilmanAtChatterbug

    Joined:
    Nov 25, 2019
    Posts:
    2
    I implemented a class named CardLoader that is used in two of our mini-games. In the first one LoadAssetsAsync does not produce the error, in the second scene the error is produced every time I press Play. The line where the error occurs is this one:

    Code (CSharp):
    1. var op = Addressables.LoadAssetsAsync<GameObject>(
    2.                 keys, null, Addressables.MergeMode.Intersection
    3.             );
    The exception:

    Code (CSharp):
    1. Scene assets can not be used with GetPlayerObjectIdentifiersInAsset API. Please use ProcessScene API instead.
    2. UnityEngine.AddressableAssets.Addressables:LoadAssetsAsync(IList`1, Action`1, MergeMode)
    3. [...]:Load(String, String, OnDictionaryReadyDelegate) (at [...]/CardLoader.cs:27)
    I am assuming a "Scene asset" is a scene? I double checked: Both scenes load the exact same prefabs. None of them are scenes and in fact I have not checked any of our scenes as addressables yet. We only have similar prefabs (with a couple of components such as colliders on them) and audio files that are referenced by them as addressables. Also everything loads and works, still the error shows up. Non of the addressable prefabs is in the scene (but they were before I made them addressables).
     
    phobos2077 and davidrochin like this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll kick this over to the team for some guidance. Which version of Addressables are you using?
     
  3. davidrochin

    davidrochin

    Joined:
    Dec 17, 2015
    Posts:
    72
    Same thing is happening to me.
     
  4. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    This is happening to me too - it's because I'm trying to load an asset (a SpriteAtlas) that has the same name as an addressable scene. I tried to fix it by loading the asset using an intersection of its key and label, but that didn't help.
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Gotcha. Could you tell me which version of Addressables you all are using?
     
  6. davidrochin

    davidrochin

    Joined:
    Dec 17, 2015
    Posts:
    72
    1.12.0
     
  7. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    @TilmanAtChatterbug unless you have Include Build Settings Scenes turned off in the Built in Data group of Addressables your scenes you've added to the build window will be included as Addressable. I'd guess that the "keys" you pass in match one of your build window scenes. As a test you could turn off Include Build Settings Scenes and then do a fresh build.

    @joe_nk That intersection only happens after everything is loaded. It's a way to filter the Result after the load has completed. So, if you have an Addressable scene (or a scene in the build settings window like the situation I mentioned above) it will still try and load that scene. Perhaps the solution above can work for you as well. If not, you may need to change either the scene or the sprite atlas name and/or label.
     
    joe_nk likes this.
  8. TilmanAtChatterbug

    TilmanAtChatterbug

    Joined:
    Nov 25, 2019
    Posts:
    2
    @DavidUnity3d Thanks! One of my colleagues confirmed that that fixes the issue for us. We saw this issue with Adressables 1.12.0. I was not aware of the checkbox.

    On a side note we were using the scene names as labels on purpose, as we labelled objects as being useable in a set of scenes. We also labelled them on a progression level, so then one day in the future we can load all assets that are allowed for scene X and match the players progression label Y from a remote database. We might want to have scenes as addressables in the future, and for clarity it at least in my mind would be good if labels could match the names of other addressable objects as in my mind a label is not an address. But of course if that is all intended by design then we can easily adjust our naming in case we end up having scenes as Addressables...