How do I load assets in a specific scene using Addressables without needing to instantiate anything given a handful of different GameObjects?

I’ve looked at several tutorials regarding Addressables and it seems that loading an asset revolves around referencing it in the inspector, loading it in, and then finally instantiating it but putting this to use so far has been very confusing for me.

Let’s say I have a handful of GameObjects in one of my scenes and they all depend on different assets and have a fixed position in my scene:

  1. Does the Addressables system automatically mark every dependency under that GameObject (Texture2D, animations, Materials etc.) as an addressable?
  2. What if I wanted to load only a Texture2D that a GameObject depends on in which that GameObject already sits in a scene? In an extreme example, I tried to mark a Texture2D that was like 100MB as an Addressable and tried to do LoadAssetAsync with the push of a button but the asset was still being used even without pushing any button to load it.
  3. If I want to load several different GameObjects that are supposed to have several different fixed positions in the scene then what’s an easier way to make sure they are positioned correctly instead of instantiating after loading and then repositioning? Making a root GameObject and parenting all of the aforementioned GameObjects under it and then instantiating the root would work but that’s just so impractical to do so every time.

1
Sort of. When building the addressable content, the build script will gather all the dependencies of whatever assets are marked as addressable (and which are within addressable groups set to be included in the build).

It will then search for those dependencies within all the addressable groups that are included in the build. If it finds them, it just references whatever bundle those dependencies are included in, but if it doesn’t, it will pull the assets into the bundle(s) of the assets they are dependents of.

The issue with this pulling is Unity will pull the same dependencies into multiple asset bundles, if there are more than 1 assets that use the same dependencies.

To avoid this it’s generally a good idea to manually mark all of the dependencies as addressable.

The only time you don’t need to do this is if all the dependencies are dependents of assets from 1 (and 1 only) addressable group that is set to Pack Together (meaning all of the assets are packed into a single bundle), because the dependencies will only be pulled in once to that bundle. However, this will rarely be the case in a mature project in my experience.

2
When you load the scene Unity will automatically load whatever data/assets are used by the scene. This includes your Texture. When you try to load that Texture manually Unity is smart enough to know the Texture is already loaded, so it doesn’t bother loading a new one which would just unnecessarily take up more RAM.

It should be noted that there may be some situations (depending on how the scenes/addressable are configured) where the Texture is duplicated in RAM, but that doesn’t appear to apply to your situation based on what you have said.

3
LoadAasetAsync, when used to load a prefab, effectively loads the prefab into memory but doesn’t actually produce a “real” game object that you can see in the scene. For that you need to instantiate the result of the load, and the Instantiate method allows you to specify a position.

1 Like