Something that’s apparently not specified anywhere.
You have a scene that has only 1 GameObject that has a script with a public AssetReference (or AssetReferenceGameObject).
Does assigning an addressable asset to that field in inspector create a hard-dependency? Specifically:
Does calling Addressables.DownloadDependenciesAsync(<scene’s address>) also download the target AssetReference?
If the scene is not an addressable and it’s included directly in build settings, is the target asset AssetReference also duplicated and included as a builtin resource?
My answers below are from experience and interpreting the docs, not necessarily by following the build logic or knowing all of the internal affairs, so perhaps someone from the Addressables-team can provide definite answers that can put your mind to rest:
When you have a GameObject in your scene that has an AssetReference field, it means its a weak reference. The asset known to the game object is only the asset’s GUID. Loading the scene would not automatically (down)load this asset as well.
This asset will only be (down)loaded when your code runs that attempts to load the asset.
No. As far as the scene’s concerned, you have game object which as a field in there with just a string value. The moment you try to load the asset behind the reference, it will be loaded from the Addressables bundle.
There will be, however, a duplicate of resources if you include an instance of the asset already in your scene. So if you have a game object with a reference in your scene, and an instance of that same object already present in your scene, Unity will treat the asset’s resources coming from an asset bundle as a new asset with different resources and will essentially duplicate the data in memory.
Just to confirm, you are correct you the answers.
The AssetReference has two strings, 1 is the GUID, and 2 is the subObject name if it is set.
Not to use AssetReference the group must have Include GUIDs in catalog enabled.