Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Addressables vs Reference - A stupid question

Discussion in 'Addressables' started by w34edrtfg, Apr 19, 2021.

  1. w34edrtfg

    w34edrtfg

    Joined:
    Nov 23, 2014
    Posts:
    72
    Hi!
    I didn't know about the existence of Addressables and after reading https://docs.unity3d.com/Packages/c...4/manual/AddressableAssetsGettingStarted.html
    i there's something that i don't see clear yet:
    When you set a prefab by reference, a.k.a:
    Code (CSharp):
    1. class Robot : Monobehaviour {
    2.   public GameObject missilePrefab;
    3. }
    Does Unity already load that prefab even i'm not using it yet for anything??????

    If true, this is something that Addressables fixes right? Be cause rather than setting it that way, i set it by:
    Code (CSharp):
    1.  var op = Addressables.LoadAssetAsync<GameObject>("Missiles");
    2.     GameObject go = op.WaitForCompletion();
    And unity will do it's magic, correct? Will Unity truly unload it when there are 0 uses in the scene? Because documentation seems to say yes, but examples show:
    Code (CSharp):
    1. Addressables.Release(op);
    And last question: Unity is well known for leaving things broken/half finished behind (multiplayer, lighting, etc..). Would you really switch to this system or it will be dead by next year too?
     
  2. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    277
    That is correct, by referencing the prefab you're making it into a dependency. This means it gets loaded automatically, as well its dependencies, and the dependencies of its dependencies, etc. This is also how the prefab and its dependencies are included in the build. This is not a stupid question, by the way - I used to misunderstand how this worked for a long time.

    Yes, kind of. Using Addressables lets you unload the Asset Bundle when it is no longer in use (eg. you used the API correctly and released all loaded Addressable instances). However, if there are multiple assets in an Asset Bundle, it won't be unloaded until you release all of them.

    Oh no, there is no magic - just very many layers of lipstick.

    Most of the development related to Addressables seems to be done by the Unity marketing department. The system itself is rather unintuitive, infinitely complicated and not very well-documented. Or maybe that's just my impression after just having spent weeks trying to get this to work in a small-scale project. Unfortunately, there aren't really any alternatives to Addressables, so I guess yeah, go ahead.
     
    Last edited: Apr 19, 2021
    w34edrtfg likes this.
  3. w34edrtfg

    w34edrtfg

    Joined:
    Nov 23, 2014
    Posts:
    72
    1. Thank you for taking your time to reply

    My idea is to use it for PC, without AssetBundles/downloading them from elsewhere. Just on a normal scene, rather than referencing as i have always been doing.

    That's what i fear the most. They do it for for medals. Medals what aren't worth much as their stock keeps going down.

    Heck, that was going to be another question, "knowing that unity will probably not maintain it, is there any alternative?". I can't stop thinking how many useless data i have loaded all-time because i use references :(
    I always thought that references weren't loading on runtime huh.
     
    apkdev likes this.
  4. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    277
    Keep in mind that Addressables are built using Asset Bundles, so you'll be using them even if you're only targeting PC. This is a source of some headaches. I recommend you try Addressables on a small project so you know what you're getting into.
     
    w34edrtfg likes this.