Search Unity

Analyze Rules

Discussion in 'Addressables' started by faolad, Jun 5, 2019.

  1. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    Analyze has two groups under Analyze Rules. The Fixable Rules and the Unfixable Rules. My question is, What's the main use of the "Check Scene to Addressable Duplicate Dependencies" under Unfixable Rules? Cause I am assuming that is for your to fix manually in that case how I'm supposed to do it? Going in each scene and dragging each of the 16061 elements to the addressable tab cause that seems too complicated.

    We are considering using addressables to have a lighter Player to launch and give the user the ability to download the scenes later on. But with these Scenes Duplicate Dependencies issues. Is this a viable thing considering that at the end it might use more of the mobile device hard drive // or a lot of tweaking from our part? Or I might be wrong?

    Lots of questions, thanks for your time!
     
  2. Kerber996

    Kerber996

    Joined:
    Nov 9, 2016
    Posts:
    23
    Here's what happend to me and how i fixed it. If in a scene you have a MonoBehaviour with for example a reference to a prefab, if that prefab is also an adressable, you will have an "Check Scene to Addressable Duplicate Dependencies" problem, since the scene and the addressable will copy the prefab. You fix it either by not having that reference or by referencing it by its *address.
     
    DKrayl likes this.
  3. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    I don't have any prefab that is addressable on scene referenced somehow until I use the Fixable Rule first. Is there any other work around that?, cause I can't come with any idea on how to make this work without a complete rework on tons of scripts and consuming lots of time and effort with a big chance of breaking stuff.
     
  4. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    And for example, There is the issue with the scenes asset itself. How you fix that? We don't have any reference to the scene asset via script. Also, the textures files have the same issue...
     
  5. Kerber996

    Kerber996

    Joined:
    Nov 9, 2016
    Posts:
    23
    You can have an AssetReference to a scene. Also you can try the second answer here https://answers.unity.com/questions/242794/inspector-field-for-scene-asset.html or something like https://gist.github.com/JohannesMP/ec7d3f0bcf167dab3d0d3bb480e0e07b for that problem. As for the references in the scene, if you already have logic in your scene with references to objects, the easier solution is not to have those objects be addressable. Then the only copy will be in the scene(when you build it i think).
     
    faolad likes this.
  6. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    After several tests, I found that if you delete all the scenes you plan to use from the build settings every error goes away. I didn't know that, and I'm not quite sure if that is the way you suppose to work with addressables. And there's no info about that on any forum or manual online. Seems like this should be mention a couple of times out there. Anyway, I'm still not sure if this is the way to go, any thoughts?
     
  7. Kerber996

    Kerber996

    Joined:
    Nov 9, 2016
    Posts:
    23
    Well if you don't build the scenes then of course you don't have duplicates between the assets and the scene as there is no scene :D
     
  8. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    I mean, it doesn't work if you disable the scene, you have to delete it from the list (build settings) in order to the errors to go away. Which is confusing for me. Since you assume that they are not going to be on the build. And they mention that the scenes are disabled automatically (feeding the belief that the issue should not be there). So I'm planning on putting some of the scenes in a local bundle group, that group is going to be built in the Player right?

    Thanks for your advice and time!
     
  9. Kerber996

    Kerber996

    Joined:
    Nov 9, 2016
    Posts:
    23
    Yes, if you put it in the local bundle (it being Static) it will be built. Here's a thing you can try: put a scene in an asset group and put a prefab into another. Then use Analise and apply the rules so it takes everything that prefab has (dependables) and puts it in a new group. I think by having a scene, prefab, and prefab dependables in the addressable assets may solve your problem.

    You see, if you have a reference to a prefab in a scene and that prefab is in an addressable group, that addressable prefab has a copy of it's dependables, and the scene also has to have a copy. When the scene isn't built, the reference to the prefab is all you need, but when it is build, it takes everything it needs for that prefab and copy's it in the scene (this was done so the built scene can load even if that prefab no longer exist, or to put it in another words, the decoupled the scene from it's references)
     
    faolad likes this.