#📦┃addressables
1 messages · Page 4 of 1
hostname from pull zone?
name.b-cdn.net/[BuildTarget]
and should i put it in BuildPath too?
because none of this works and drops exception:
where's the https://?
the build path is the path to where the addressables should be built to on your machine.
ServerData/[BuildTarget]
Will put it in <drive>/UnityProjects/ProjectName/ServerData/Android
oh, got it. 
https is present by the way, still throws exception
it's difficult to help when you don't provide things exactly as you have them.
name.b-cdn.net/[BuildTarget]
This doesn't look very unique. How is the CDN supposed to point to your bucket (or whatever name they use)
i should stop making examples and just show screenshots instead, i guess
is creobitdata unique to you?
it would be surprise if it is not, but i get your point.
i'll try something more unique
I haven't used this platform you are, no idea if
creobitdata was given to you -> fine
is the host -> not fine
is something you added -> fine
i just follow the tutorial because this thing is needed for one test program for job offer, so i'm also in the dark here, and running out of time a little
it is something i added
whats the correct way to check if an asset reference is already loaded so not to load it again?
unity has not got very good code samples to learn addressables
I tried IsDone and IsValid but neither of those seem to be correct
Are Addressables a good way to make Scriptable Object references into savable data?
I have this idea of using Newtonsoft alongside Addressables, to make inventory items in my game use an Addressable "Asset Reference" that leads to the Scriptable Object they're meant to use.
i'm going insane here.
addressables throw Invalid URI: Invalid port specified. exception on pretty much anything i put in LoadPath.
i tried a lot: CDN, local FTP, local directory, native RuntimePath.
i'm guessing here that my addressables are just broken.
Any ideas?
Or better yet, any way to unpack bundles manually in code? Cause i think loading and unpacking them manually will be better solution now 
fucking nevermind me
it works now
Now i know that you have to rebuild assets

What are addressables and what do they do?
I usually check if .Asset is null
yeah im doing that aswell but i find it confusing what IsValid and IsDone is suppose to be
the docs kind've suck at explaining them
IsDone is when the loading operation as been done and IsValid seem to be if you can try to load the assets. At least from what I have seen.
so IsDone is true if essentially .Asset is not null?
It can fail I believe. If like it isnt valid I believe
I had issue earlier when trying to only use IsDone
So I used .Asset to check
@frigid stag quick Q, if you add a scriptable object as an addressable and it references a unity object say a mesh file, does that mesh file also need to be marked addressable or is it automatically done for you
All dependencies are included in the build, and that is a dependency
ah so i dont need to mark them as addressable unless i want to load those mesh files by themselves in other situations
rebuilding addressables every time i change something is such a slow down on dev time
It is, but you can usually get away with simply using the AssetDabase in Editor. Also, you do not need to build everything, if you are working on a considerable project, you can build some of the addressable that you need. No need to build 20 maps, if you only need 1 for your test.
is there a way of speeding up the loading for these addressable prefabs that include models. The initial loading is quite slow. After loading them once, they are in the cache, even after restarting the application (which makes testing speeds quite annoying because I can't find a way to empty it)
Any setting I could change to make the intitial loading faster? Online I read a lot of conflicting things e.g. using unitywebrequest is faster even if the files are local (but this would only apply for android?). Also uncompressed is faster than LZ4?
i just downloaded unity and its using thunderoad (which is the game thing for b&s) and while its loading the timer stops and it doesnt load
whats the problem?
This might be a dumb question, but does the Android platform support Addressables (prior to the Addressables for Android for Unity 2023)?
I've been using Addressables for PC (Unity 2019 and 2020) for a while and thought that mobile was supported, but I'm really struggling to get a working apk with addressables and Asset Bundles. Is there something I'm missing? When I build out, the apk is smaller than expected and no addressables load, so they files must not be present. Is there a StreamingAssets folder in the Android build folder I can move them to manually?
There are no plans for a Google Play store release, so hacks are welcome.
you need to build addressables bundles separately for each platform
Hi there, I have a question that's stumping me... In the cloud build I have written a PostExport script and configured it; this script is being called and what it does is it Brotli compresses all of my Addressable files one by one and then it deletes the original .bundle files. I have debug logged to confirm it works in the cloud build. So far so good. ✅ Now, when I try to click the 'Download Addressables' button in the Build History I get the good old zipped folder with the .bundle files instead of my .br files... HUH? 😆 Does anyone know why this would happen?
Solution: Hey everyone so in the end by logging things we came across the fact that the download button downloads from a certain path on the cloud server. You can use the following path to reach there. Hope this helps someone who comes across it! ${WORKSPACE}/.build/last/${BUILD_TARGET}/extra_data/addrs/
is there no true way to background download addresables in webgl? 😐
all download methods freeze my game until the download finishes 😐
I mean, I can do it in javascript 😐
it's just fetch and continue with your life
@bitter root Unfortunately not -- WebGL only has a single thread available to it.
Thank you for the reply. The problem was that I didn't know the semantic difference between [] and {} in the addressable paths.
I found CachedFetch.js inside the editor installation folder...
Maybe I can fix him? 🥹
99.9% of the way there... now I only need to get a list of all addressable bundles...
unity catalog ain't helping 🥲
hello can anyone help me with this errors, the build of the addressable is field and I don't know how to fix that
Is the file path over 256 characters? If so, it is likely the common file path limit issue on windows
Or you can move your assets so they are closer to the root Assets folder, keep folder paths as short as possible, and keep the asset names as short as possible
Are Addressables the recommended solution for storing things like ScriptableObjects? I have a bunch of Weapon & Armour scriptable objects and am wondering what the best way to store them and reference them is so I can reference them later in code (like when a weapon is equipped to find the weapon scriptable object and attach it to a player class)
It's a recommended solution if you want to manage and load things by simple keys and labels regardless of the actual file paths.
Hi
How can I fix this??
I use addressables to load audio clips
When I load this from bundle I have this error(
HI all, my team is trying to decide between two strategies for packing Addressables. The game uses a dynamic streaming solution where assets are organized into cells, and different cells of content are loaded/unloaded as the player moves around the world.
Strategy 1: The Game Object Prefabs that are actually loaded/unloaded are organized into Addressable Groups by content type. At the moment this means Terrains go into one group, and non terrain goes in a separate group. For the terrain, Pack Separately is used, so each terrain gets packed into its own bundle. For the non terrain, there can be multiple prefabs per cell, so all prefabs that are associated with the same cell get the same label, and Pack by Label is used. So basically the content that is loaded/unloaded together can be packed into the same bundle. For dependencies (meshes, shaders, materials, etc.), everything is placed in a single Group that is Packed Together, with the idea being that most of these assets will be needed no matter which cell the player is in.
With this strategy, most of the memory used by the prefabs is freed right when each cell is unloaded, which is optimal. Some memory from the dependencies might not be freed even though it could be, however Resources.UnloadUnusedAssets can be used as a fail safe if memory grows too large.
Strategy 2: All prefabs (terrain and non terrain) and dependencies are placed in a single Addressable Group set to Pack Together.
With this strategy, Resources.UnloadUnusedAssets has to be called fairly regularly since assets from the single bundle aren't unloaded automatically. This results in noticeable lag during game play.
You might be thinking, Strategy 1 is the obvious winner, however there is a conundrum that we can't figure out that is confusing the issue. On both my PC and iPhone, RAM usage is nearly identical between the two strategies. However, on my teammates iPhone 13, he is crashing upon startup and says the memory is going over 3GB.
_ _
Yet with Strategy 2, he does not have this problem.
_ _
This isn't making sense to me, as as far as I can tell there are not enough additional asset bundles with Strategy 1 to make a difference (they are KB's in size). So two questions:
-
Does your understanding of the packing modes support the notion that Strategy 1 should be the winner, and not result in a large increase in RAM usage?
-
Does anyone have any ideas as to why RAM usage might be higher with Strategy 1? Is there a possible Addressable Setting somewhere that could be causing this, or must it be something unrelated (some bug or other issue)?
Sorry for the long question!
For reference, this is the build report for Strategy 2.
And this is the build report for Strategy 1. As you can see there is hardly a difference in the size of the output
I also checked the catalog sizes to see if there was a big difference. There was not
Also perhaps worth mentioning. My teammate is using a PC to build the addressables for iOS, using the well known hack. Whereas I am running two tests. One for a Windows Build on PC, and one for an iOS build using a Mac. Is it possibel the use of the PC to make the iOS addressables is somehow resulting in the RAM difference?
what does the profiler say about the RAM usage?
@hoary rampart On my systems the RAM usage is nearly identical for both strategies with Memory Profiler. My teammate has not been able to test either strategy with the profiler, because strategy 1 crashes on load and also due to some quirk with building the addressables on PC for iOS, he is not able to connect to the editor.
@next inlet pls have a look at addressables best practices pinned in the channel.
I have sprite atlases that are included in the addressables, the Include in build checkbox is disabled
Tell me the correct way to load sprites from this atlas into objects on the scene? What is the best way to do this?
Thanks. I just read through that and it supports my thesis that strategy 1 is better for an open world mobile game. However, my teammate is quite sure that strategy 1 is causing crashing due to high memory use.
Do you think this is remotely possible or must something else be going on?
Everything I have read says that having more bundles can possibly increase memory use, however from what I have seen the bundles are each only KB in size.
The other concern mentioned a lot is the increased catalog size, but I haven't seen much of a difference between the two strategies
you should really do some profiling to see how many bundles are actually loaded in memory at a time, on different devices. The different bundle builds could be the culprit but it's hard to say at this point
Profiling is the best way to know what is happening. You can easily look into which bundles are loaded and what are the issues.
Hi there! how is going guys? i have a question about addressables because i use "cutsceneinstanced" gameobject to access his playabledirector and do play, but when i release it it remaining the gameobject in scene, i need to destroy it? chatgpt ask and told me its not necessary to be destroyed but then is reamining in scene with all content of the cutscene
well, after search in google unity docs, community, etc.. i cant find a solution but in my hierarchiy remains the gameobject
if i did this its clean then
@neon pilot since u r instantiating it manually so u have to destroy it manually too. If u use instantiateasync function of addressables class release function will handle the deletion for u. This is also explained in the documentation
omg! i forgot this and is very basic! so thanks so much for support 😉 i just tested and you are right it works fine now without. destroy
I surely cannot be the only one encountering this. Addressable builds seem to ignore Animation Clips embedded inside models (e.g. fbx), and even though the model is marked as "Addressable" (and also the clips on the animation tab), they are simply ignored and not included in the Addressable build
Worse, the Animation clips are all extracted and included in the base build (Which is critical as this prevents making a Google Store submission when you are trying to keep the base build size down)
Additionally, the same happens with "sub meshes" of a model, which are also only extracted to the base Unity project and skipped in the Addressable build.
Thoughts anyone?
Also created this discussion post
https://discussions.unity.com/t/addressables-build-is-packing-animation-clips-anim-and-mesh-data-mesh-in-base-project/1502261
Yes, If I separate the clips out of the model, they can be packaged. But this requires you to also remove them from the model, else you just have duplication.
OK, after further examination, it turns out the Animations and Meshes are actually in the Addressable Bundle. HOWEVER, they are also duplicated in the base build #facepalm
Anyone got any ideas for how to exclude these?
@prime relic are u referencing ur fbx or its prefab in a script or scene ?
Our team is using Unity 2022.3.32f1, and we are seeing some performance issues related to shader loading/unloading when using addressables (Shader.ParseMainThread and Shader.MainThreadCleanup). What is the recommended way to deal with this? Using Shader Variant Collections?
I read from a Unity person on the forums that they were working on getting this shader loading/unloading work onto a background thread, but that was back in 2019 and I can't find any information on whether this was ever added in a newer version of Unity. Anyone have any clue?
No, all prefabs are instantiated at runtime using dynamic configuration.
Essentially what seems to be happening:
1: The Addressable build process runs
2: It unpacks the Models for build
3: Creates the addressable packs
4: Removes ONLY the model file itself from the build
5: packages everything that is left in the core build
Seems to be a genuine bug in the Unity build system, which surprises me that it has existed for so long
(Confirmed the same in a test project with ONLY the model file, not even a scene)
I've created a custom build script which actually deletes the built folders after the addressable build which seems to resolve it.
However, now I'm having issue trying to run the "Play Asset Delivery" build script for Addressables instead of the default build.
Very little docs anywhere on how to build custom build scripts with addressables in C# (which is needed for automation)
Anyone got any thoughts on how to change a default build script (as shown below), to one that will use the "Play Asset Delivery" addressable build script?
[MenuItem("Build/Custom Build with Addressables")]
public static void BuildGame()
{
// Step 1: Build Addressable Data
AddressableAssetSettings.CleanPlayerContent();
AddressableAssetSettings.BuildPlayerContent();
// Need to build "Play Asset Delivery" script and not default
}
OK, this seems to hint at how to customise the Addressables Build
OK, progress, it is a little destructive and likely only actually useful for automation (unless you like Git revert "a lot") but essentially the process is like this:
- Perform an Addressables build using the "Google Play Delivery" profile
- Remove the folders containing the packed content
- Run a Unity Android build
- Profit
Critically
You must ensure that the "Addressable" build settings are set to NOT build with the project to avoid the addressables trying to build twice.
Also, only use the custom build script during automation, or with a folder projected by git (to recover what was removed).
Possibly you might be able to rename the folder(s) your packed content was in with a "~" prefix, then rename it again afterwards
Actually, might try that now
Addressables.LoadSceneAsync has an activateOnLoad parameter that can be used to delay the activation of the scene, which is great. Is there some way to do the same when using Addressables.LoadAssetAsync?
I need this because I have tracked some performance issues down to the Single Frame Integration of multiple Addressable Assets that I queue up to be loaded at the same time. Without any control over the loading, the assets end up getting "integrated" all at once, whereas if I could delay the integration, I could control it in an orderly fasion (only allowing x assets to be integrated in a single frame).
I know I could probably load each one individually, but as far as I can tell the actual loading does happen on a background thread and doesn't impact the game, so queuing them all up at once results in faster loading.
It's quite strange that there is no mechanism for doing this considering every other Async load method has this functionality.
Is it weird to store an asset reference as a field of a gameobject for help keeping track of instance count and then unloading when it reaches zero
the changelog tab
on android I always get a hang on first load after install.
the first thing I do is download the basic app dependencies. it's failing to find a key file, but I think it's trying to access it too soon. on second load it works. code attached
maybe it's my shitty progress bar
hmm nope. it's an addressable error. I think I can replicate it with a dev build maybe
it spends quite a while downloading, it's just that after that addressables can't find the file I need
in the end I just force-restart the app on android after the first download
that worked
Does anyone know why the first addressable request takes so long, the subsequent calls are fine
: o
nope it doesn't
Man addressables are so meh
var sceneLoadHandle = _addressableScene.LoadSceneAsync(LoadSceneMode.Single);
If i yield return this it hangs forever
No error
funnily enough this only happens the first time when i dont have the file
It downloads it fine, but dont load the scene
If i reload my game and the file is downloaded itll load the scene
LoadSceneAsync gives me this:
Scene 'Assets/Scenes/UIs.unity' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
And it only happens on the build not editor
did you manage to figure this out? having same issue on a win build
seems like 1.21.20 has issues?
aware of a bug but dont attempt to reproduce
great
time to make a new repo
yep so addressable scene loading is broken for all of 1.2.0
addressables have been broken since release tbh
Any alternative you know of? I kinda dont want to downgrade
The only thing which is a issue rn is the scene loading
asset bundles
load t he scenes from asset bundles until they fix the scene loading
hmm dont the asset bundles get loaded in memory though
This is the behavior i was trying to prevent
only if you call assetbundle.load
np
another alternative
you could serialize the scene to a json file
like save all the objects and their position and all components on the object etc to a json file then instantiate it all one at a time
will work fine for small scenes
but prolly not so w ell for large scenes
ic ty im going to try the asset bundle stuff and see if it works
I ran the analyzer and it decreased build size by putting everything in the duplicate asset group. I then moved parts of it(the characters and all assets they use) into a different group and build size increased again. The characters group doesn't reference any bundles and it is not referenced directly either(only by assetreference). What am I doing wrong? Am I not supposed to group assets used together?
So the different group you need to make sure the settings are set to remote
if you select the group, it should show the settings in the unity editor
Note how my build and load paths are remote
I'm not deploying on a remote server. Why would this affect build size?
If you set it to local, it will include the whole groups assets in the build
all my groups are set to remote. So the build dont include all my assets. I use this to download it https://github.com/JayArrowz/AddressableSceneBug/blob/main/Assets/LoadingScreen.cs
even my scenes are set to addressables (But this is bugged iin addressable 1.2.0+)
It's an offline game. I can't make it remote.
My scenes are addressable too
i only said this because your original question mentioned decreasing build size
The only way i've seen the ways to decrease build size is if the assets aren't actually in the build and served remotely
You can use compression like LZ4HC
to decrease it further though
Maybe. But the issue is that the build size is low(1.69gb) if I leave everything in the jumbo duplicate asset isolation group. If I group related assets into another group the size jumps(3.6gb).
Am using LZ4HC
if you separate things into different bundles and the total size increases that's a pretty surefire sign that there's references you're not aware of still causing duplicate assets, if the analyzer isn't being very helpful you could try this: https://docs.unity3d.com/Manual/AssetBundles-Browser.html to inspect what's in the built bundles
Thanks. I'll try using this.
Hey folks! If I load a particle effect prefab from an Addressable, it has no material in builds (or in editor while using the existing build). The Addressable Report lists the material under the prefab. Any idea what's going on there?
well that's... sad. I was trying to make an experiment to make maps in a different project and just have my main project load the assets from an online bucket. That way I wouldn't have to update the maingame everytime I make a map. So this isn't possible?
No you'll have to downgrade addressable version
No reply on forum too
Looks like they don't give a toss
Where do you guys host your addressables?
Hi
we are loading a scene from the addressables
the bundle itself is loaded successfully, but then it can't find the scene in the bundle and can't load it
the scene name and the key name in the bundle are the same
this problem occurs when many different bundles are loaded during loading, if you try to load the scene in the game through the debug menu in the same way, it finds it in the bundle
we tried to set a delay before calling LoadSceneAsync but it didn't help
Scene 'Assets/Game/Scene/Scenes/Hotel_03.unity' couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings...
I reproduce this in unity editor
What’s the correct way of freeing up memory? I’m using the Release() method but the memory only goes down if I use Resources.UnloadUnusedAssets(), which always causes a stutter.
Any info about this would help me a ton!!
Would a question about localization package make sense here?
I am trying to change the "String reference" of "Localize String Events" through code, like this :
public LocalizedString Title {
set {
this.titleTextUpdater.StringReference = value;
this.titleTextUpdater.RefreshString();
}
}
But when I do, the "Locolive String Event" seems to stop working. It stops reacting to me changing the game's language, and even dispalys a different default language than the rest of the game on startup!
Interface is English (correct language the game is in ATM. the Localized String Events there are not code-changed)
But the cards display the other language available : French. This is where I applied the code shown above
OK... Made a few more tests and here are a few new things :
- If I make a build, things go smoothly there
- The amount of "texts displayed in the wrong language" can vary after changing scenes, etc
So this has to do with the way the editor accesses Adressables data that have not been compiled to adressables yet, I believe (direct asset access, I am no longer sure how it's called)
I think the editor can be setup to use the compiled adressables instead of doing that direct access. i am going to try that
Doing that actually solves my issue.
I'll just have to recompile my addressables every time.
But I'll leave all that stuff here, could still be useful info to someone or the unity team. There clearly are some issues with that "use asset database" mode. it does not replicate the behavior of adressables properly in this case
Anyone know how to build to a specific path ?
When i do that i have an error and i don't know why 😩
I try to build to D:/Assets
Error:
Hello. I have 500 groups in addressable, each group has prefabs, of which there are 11 groups with an approximate number of prefabs of 100, each prefab has 30 child objects with the Sprite Renderer component. The remaining groups have about 20 prefabs with child objects (about 30 objects), which have animations, a sprite renderer. When assembling bundles, I consume more than 220 GB of RAM for the dependency calculator process. Please tell me how to optimize this? Maybe I'm doing something wrong. The project is growing and soon I will not be able to assemble bundles.
If all that is contained is the sprite render, you could use only one prefab, and have a script to load a different sprite.
in 11 groups mostly only sprite renderer, but in the rest objects with sprite renderer and animations
I just changed my SceneManager.LoadSceneAsync to Addressables.LoadSceneAsync. In editor there is no difference but in built Webgl app it is much slower and buggy. Any settings I need to do? I'm using List<SceneInstance> activeScenes to store the activeScenes.Add(await Addressables.LoadSceneAsync(AssetReference, LoadSceneMode.Additive)); for Addressables.UnloadSceneAsync(SceneInstance) later when scene changes
Hey, I'm having alot of issues with addressable. Everything works fine in editor/player but when I build none of addressables is moved into build.
Forums told me to try going into addressable groups window and hit build there first, that succeeded the first time now throws an error every time even though nothing has been changed in the project or addressables.
Was told to try using the analyser in addressables but It runs for infinity stuck at importing assets.
The only thing in my addressable groups is terrain data as that's where most of my memory usage is in my game. Plan to add more to addressables later, but can't get this to work
Screenshot of errors when i click new build inside addressable groups
I'm using LoadContentCatalogAsync and the RuntimeKey and GUID seem to become the addressable key. Is there any way to stop this?
Got it figured out. Added a stack trace to the BuildScriptPackedMode file and found it was the ScriptableBuildPipeline.json file was nulled out and throwing an empty document exception in preferences.cs LoadSettings method. I copied this file from a blank project with addressables installed and built and it now works.
Hi. I want to load assets from remote path (../[Environment]/Android if the environment of the app is set to beta) Can someone help me how to do that?
I'm very new to addressables but should be relatively simple. Either change the value of the path at runtime based on a flag. Or you can use preprocessor tags like #if BETA to compile different pieces of code based on beta or production flags.
My remote Addressables was easily done for UnityCloud but im having trouble for Amazon AWS. I only changed the LoadPath to AWS URL but somehow it can't access the files or something
Check my msgs
To all of you guys who are having issues with addressable scene loading
There is no fix for it, and its been like that for almost a year
I host it on AWS s3, and use cloudfront on top
thanks for this, I fixed mine as well, turns out AWS needed some more setting up
if you use S3 alone the cost will be great
did you manage to get around scene addressable loading?
or just downgraded?
yes. wait what exactly are people having problem about scenes?
So imagine you distribute your game and the scene doesn't exist in your initial distribution. So the addressable system has to DL it. Once that happens, The scene is not added to the unity scene list and you cannot load it without restarting the game
check readme for error
ohhhhhh no wait
It dont load the first time :\
I have to download the scene then exit the game
then restart the game
For the scene to load
ohhhh I get you
Its only if you're using addressables >= 1.2.0
So if I update the cloud, will need to restart the app first before it gets the updated catalog?
Updating wont be a issue, but the first time users running the game if they are downloading scenes, theyll have to restart the game after the scenes have finished downloading, otherwise the scenes wont be able to be set to active
what the heck
yea ik
Ive been trying to get this issue looked at for 1 month now
Its been reported a year ago
hold on what does it look like when you test it?
let me also check what version im using cause I manage to load mine without any issues. Load a scene and set it to active
so in my game i have this screen first, whihc downloads the assets including scenes. Then it switches scenes to one i downloaded after the dl finishes. When i finish downloading the scenes wont be switched cause i have not restarted
It will just be stuck
If i restart after downloading its fine
Gives this issue:
at UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.InternalLoadScene (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, System.Boolean loadingFromBundle, UnityEngine.SceneManagement.LoadSceneParameters loadSceneParameters, System.Boolean activateOnLoad, System.Int32 priority) [0x00017] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.ResourceProviders.SceneProvider+SceneOp.Execute () [0x00077] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () [0x00000] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) [0x0008b] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) [0x00000] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.ResourceProviders.SceneProvider.ProvideScene (UnityEngine.ResourceManagement.ResourceManager resourceManager, UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneParameters loadSceneParameters, System.Boolean activateOnLoad, System.Int32 priority) [0x0004b] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.ResourceManagement.ResourceManager.ProvideScene (UnityEngine.ResourceManagement.ResourceProviders.ISceneProvider sceneProvider, UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneParameters loadSceneParameters, System.Boolean activateOnLoad, System.Int32 priority) [0x0000e] in <8ca064ccd930487f9d9e4a1371e793da>:0
at UnityEngine.AddressableAssets.AddressablesImpl.LoadSceneAsync (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, UnityEngine.SceneManagement.LoadSceneParameters loadSceneParameters, System.Boolean activateOnLoad, System.Int32 priority, System.Boolean trackHandle) [0x00020] in <de4f843f379446e18f14228fd803abe8>:0
at UnityEngine.AddressableAssets.AddressablesImpl.LoadSceneAsync (System.Object key, UnityEngine.SceneManagement.LoadSceneParameters loadSceneParameters, System.Boolean activateOnLoad, System.Int32 priority, System.Boolean trackHandle) [0x0005d] in <de4f843f379446e18f14228fd803abe8>:0
at UnityEngine.AddressableAssets.Addressables.LoadSceneAsync (System.Object key, UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) [0x0000c] in <de4f843f379446e18f14228fd803abe8>:0
at UnityEngine.AddressableAssets.AssetReference.LoadSceneAsync (UnityEngine.SceneManagement.LoadSceneMode loadMode, System.Boolean activateOnLoad, System.Int32 priority) [0x00027] in <de4f843f379446e18f14228fd803abe8>:0
at LoadingScreen+<Preload>d__9.MoveNext () [0x000c9] in <ddf5da6850b3418da299f9379d5432e3>:0
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <e422ced3d0f64bb29423e8338d57bc04>:0
try your game on a new PC or clear your game addressable download folder
And see if it switches scenes properly
Are you making scenes addressables?
this was my code for loading/downloading assets https://github.com/JayArrowz/AddressableSceneBug/blob/main/Assets/LoadingScreen.cs
that is... weird. now that I think of it I don't change scenes in mine. When I load a scene I just additively add the scene and set it as activescene.
Ah i cant even do that, ive tried it
you basically want to delete this then run the game to test it
C:\Users\YOURUSERNAME\AppData\LocalLow\Unity\YOURPROJECTNAME
Thats your downloaded addressable files
uhuh this all looks good. Yeah I pretty much just use the latest version of Addressables. Altho I dont manually download dependencies... aren't dependencies automatically handled by AdressablesPackage?
they are not. So you have to manually call Addressables.DownloadDependenciesAsync to download them (if you are preloading). Your code also changes to use AssetReference's and if you do not, the addressable will be included in your build
You dont need to call Addressables.DownloadDependenciesAsync but then the download will happen once you need the object
Which isn't that nice cause users have to wait
I use:
Addressables.DownloadDependenciesAsync(_label)
Where my label is something like "downloadOnStart"
And then i label my addressables which should be downloaded right when the user runs the game
so lets say you have a scene which is not an addressable, but the scene references an addressable without using AssetReference, it will be included in the build which is not something people using remote addressables want
ohhhhhhhhhh damn now that is something
I just learned addressables this week tbh. Doing them remote
I was thinking about how dependencies go once you reference remote asset bundles will they be included in the build
So imagine this script:
public class AScript : MonoBehaviour {
[SerializeField]
private GameObject _gameObject;
}
Now regardless of this script being in an addressable or non addressable scene. If my _gameObject is a prefab which is an addressable. It will not ACT like an addressable because i use GameObject instead of AssetReference
I guess I didn't encounter that problem because in our use-case we basically just call the scene by addressables ONLY. Like calling a roblox map or smt
yeah that makes sense. So then unity includes the GameObject in the build... because of how you referenced it?
yes
Addressable Instaniation has 2 steps
Downloading -> Instaniating
I do the download at the start of the application so the downloading phase is already done and its not loaded in memory until i need it, so instaniating is pretty quick and user isn't waiting around for downloading when in the actual game
I don't get it. Doesn't make sense why doing this to Scenes will cause it to not work
bug in unity's code
So it's either we change to a lower version of Addressables or only use addressables in more simpler straight forward way
yea lower version of Addressables should work OR not use em at all
OR
dont include scenes in addressables
its not too much of an issue if your scene is small
What if you not reference addressable scenes but just call them by Tag so when building the scene it doesn't get included?
But you'll still need to get the addressable system to download the scene, the problm the bug is when the scene is NOT included in the build and added dynamically
This is my scenes rn on my build, I only have the asset downloader in my build which downloads my KitsuMapOne and UIs
it does not
** Downloading and then loading them without a game restart between the stages does not work
I submitted it just now to the report bug, nobody on forums or discord looks like they can help
@solemn apex Oh yea i forgot to mention
the bug isn't in the editor
So if you run it with the editor itll be fine 🤣
If you build the game, then run the exe it wont
Alright ill get back to you guys after a while its a little late. Also Find this really weird. Been using a macbook pro at work and used Unity Cloud and AWS to load our scenes. I don't even preload the scenes I load them when you pick the map. Like if you pick Level2 it will then just call Level2Tag -> LoadSceneAsync -> SetScene as active
no problems. Scene then has things like spline, scripts and baked occlusion working
Where is Analyze Tool in Unity 6? Also didn't find in docs
Addressables version 2.2.2
they deleted it without telling anyone because they thought it would be funny https://discussions.unity.com/t/unityeditor-addressableassets-build-analyzerules-missing-in-addressables-2-0-8/943666

Hi, is it possible to make a player able to choose to have English subtitles and Spanish audio using Unity's Localization package?
I have this error most of the time when update a previous build. Do you know how to fix it?
Hello all, can i use aws s3 bucket to handle unity addressable? and preferably the s3 bucket is private / have some protection so it not publicly accessible. is that possible? and how can achieve that?
coincidentally also working on this for our project, I want to know too. right now just I just set it to public
@small sorrel @sudden drift I have read about it somewhere in the addressables documentation but can't seem to find it at the moment. This forum post has a solution for it. maybe give this a try
https://discussions.unity.com/t/how-to-add-access-token-to-ccd-request-to-private-bucket/900276/8
i see thank a lot this might be something i could try
@candid pelican @small sorrel @sudden drift i am trying to test the load and unload prefabs on demand. right now i have one simple prefab with its mesh and shader. all of them are addressables checked. The prefab and its related resources are correctly loading and unloading from memory, but even after unloading something tagged Untracked taking a huge memory space. my main goal is to reduce memory usage after unloading. any solution, please?
even after unload? tbh im not sure since im also starting using addressable, so i cant help much. But maybe you can manually call garbage collector? im not sure its works tho.
Maybe other's expert in this topic can help you in that, im very sorry cant help much
do you have other stuff from the same asset bundle still loaded? iirc you'll see the bundle staying in memory until every asset from it is unloaded
see in the addressables event window if its reference still exists after the unloading
yes its reference count should be zero
its reference count is zero
but something called untracked is taking space
thanks anyway
the addressable group contains only the stuffs i mentioned, don't know anyhting about the asset bundle...howto check it/
pls share ur loading script
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
public class PerformanceOnSizeTest : MonoBehaviour
{
AsyncOperationHandle<GameObject> handle;
public string prefabToInstantiateAddressableKey;
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
handle = Addressables.InstantiateAsync(prefabToInstantiateAddressableKey);
}
if (Input.GetKeyDown(KeyCode.A))
{
Addressables.ReleaseInstance(handle);
Resources.UnloadUnusedAssets();
}
}
}
pretty simple one
Untracked seems to be the memory unity reserve for later, but it actually not use anymore I think
ohhh. might be the memory from memory profiler...
the thing with untrack is, you don't really know where it come from. but I know some time openning memory snapshot also increase it
can you suggest me how can i see memory usage properly for android build
Just normal workflow of development build + attach profiler.
Profiling prefab might be hard to look for depend on what's on the prefab & its dependency to other bundle though.
should i use scenes then? trying to implement a huge world streaming
I mean, it's hard in that you have to know what u put in prefab and know where the memory cost will go, audio will be shown in audio section, texture in video memory, mesh in other place etc etc. I would do it with prefab first. managing multiple scene seems harder in your use case, for prefab you can just directly reference them. & put them into list nicely. and loading addressable scene have some implication which might be hard to reason about.
Do Addressables not work in unity 6? I imported the package but cant use UnityEngine.AddressableAssets like if I never imported it
it works fine in 6, are you sure it's not missing from an assembly definition you're using or something like that?
I dont know what its missing, in the editor it works fine, it only becomes problematic when I try to access it in code
I just installed it so I dont think its missing a definition unless the package manager did an oopsie, but it should do all that on its own, no?
All it took to work was to restart unity, how I love this engine sometimes
I am trying the "Fix" step for Check Bundle Dupe Dependencies analyze rule for around 19k duplicated assets in bundles. This always gets stuck at the importing assets step. I have let it run overnight for ~9 hours but still the process won't finish. I had to force quit and open unity. I do see that all the duplicate assets are now moved to a separate group.
To counter this behavior I wrote a custom rule similar to Check Bundle Dupe Dependencies but this time instead of processing all the bundles, I forced it to fix just one bundle with one duplicated asset. I still see the same behavior where unity is stuck on importing assets step which is very annoying... Has anyone else seen this behavior with Analyze Rules. Using unity 2021.3.42f1 and addressables version 1.21.20
Apparently few assets which addressables system was trying to group contained [] in the asset name which in turn is used in it's address path. The system is not able to recover from this error.
I had to skip all the assets with [] in the name and run the Fix step for everything else.
I built addressables locally and noticed a strange update to the AddressableAssetSettings.asset file. The m_currentHash value is updated to 00000000000000000000000000000000 Has anyone seen this before?
But I'll leave all that stuff here,
PROBLEM RESOLVED!!!
Hello, guys! I was wondering if I could get some help with a script. One of my team's coders (now on hiatus) recently converted some functions in our game's AssetFinder script to return an async Task<GameObject>. However, all the other functions that he hasn't touched are expected to recieve a standard GameObject. I'm not sure how to convert it to a normal GameObject, and I would appreciate some assistance, as I've never worked with Addressables or ASync.
NEW FUNCTION EXAMPLE:
{
string[] guids = AssetDatabase.FindAssets("t:Prefab");
foreach (var guid in guids)
{
var path = AssetDatabase.GUIDToAssetPath(guid);
var operation = Addressables.InstantiateAsync(path);
GameObject go = await operation.Task;
if (go != null && go.name.Equals(prefabName))
{
Collectable goCollectable = go.GetComponent<Collectable>();
goCollectable.type = goCollectable.itemSO.type;
goCollectable.icon = goCollectable.itemSO.icon;
return go;
}
// Clean up if the prefab doesn't match
Addressables.ReleaseInstance(go);
}
return null;
}```
I need to take the result and turn it to a simple GameObject
This code is very suspicious; why would you be using editor-only code with addressables?
AssetDatabase only exists in the editor, this code would not be able to be built with the game
Not sure, this was a script written by another developer. However, xEvilReeperx helped me reach an alternate solution in #archived-code-general. Thank you for your expressed interest, though! I really appreciate it! 😄
Hi guys. I have only half a question about addressable. I've been looking for an answer to the question about changing scenes for a couple of days. I've seen the practice of using an empty scene between unloading one scene and loading another. But no one can explain why this is necessary. And at the same time, everyone claims that when using addressables scenes, this is not necessary.
And the next problem is that I want to build the architecture of the game on one base scene where to store all the common things and the additive scenes that will be loaded into the base and unloaded. As I understand it, in this case, an empty scene will not work for me at all.
Please explain this problem with loading scenes and how best to do it for my architecture variant.
can anyone please explain me the Bundle Mode in addressables? i can't understand it properly even after reading the documents
Hi! I was testing "Addressables.GetDownloadSizeAsync(key)" and there was something i'm confuse about in my testing. This method actually get whole size of my addressable asset instead of an individual. I'm showing a debug log on each of the key to get its download size but it keep stating the same value. To my surprise when I initiate download, It also download the same amount of size.
My question is, does that method return the full size of my addressable instead of individual (by key)?
Got the answer for this. Its actually because the bundle mode in group setting for the addressable was set to "pack together"
I’m trying to wrap my head around something that should be incredibly straight forward: have multiple Addressables.LoadAssetAsync() calls simultaneously on different game objects that each need to load their own respective textures. There’s no overlap between these calls, yet I’m always hit with Exception of type ‘UnityEngine.AddressableAssets.InvalidKeyException’ was thrown. No MergeMode is set to merge the multiple keys requested” I tried awaiting Addressables.InitializeAsync() first to ensure that this isn’t the issue, to no avail. Any pointers?
are you sure it's the fact that you're making multiple calls that's causing the problem? do these requests work on their own?
Yep, they work on their own, or if I spread them out in time
🤔
hmm are these remote or local assets, and are they from different bundles or the same bundle?
Local, different groups (and therefor bundles I imagine)
can you share any code?
that InvalidKeyException can sometimes be misleading, it gets thrown for various reasons, but i guess you should only need to set a merge mode while loading multiple keys in one call or if one key resolves to multiple locations for some reason
Well, going through it again and using Addressables.LoadAssetsAsync<Texture2D>(..., Addressables.MergeMode.Union); it actually ended up working. I'm not sure where it went wrong before - I think it it might have also thrown a very similar error due to a texture missing, and I glossed over it thinking it was the same error
This controls if all the assets in a group go into 1 AssetBundle, or many. "Pack together" will result in 2 asset bundles (1 for all assets, 1 for scenes if any)
The others will cause many smaller bundles to be made instead. Can help with download size or loading.
I have no issues changing scenes with addressables. We primarily use additive scene loading always and I usually load the new scene and unload + release the other at the same time (i await both operations via UniTask).
fyi additive scene loading can cause problems with baked light so you need to make lightprobes recalculate after loading is done.
Good day everyone. I am quite new to the addressable term in cases of remote collections. I rather have a general question. are addressables also capable of delivering content like assetbundles with the whole LoadAsset() pipeline across different apps or are they bound to a specific app and/or version of it?
for the love of gawd, i don't why keep getting this at the addressables module while profling, is it adding the same build layout over and over or something?
Did anything change with addressables in unity 6? Having an issue that didn't happen in an older 2023 version of unity where every single addressible fails to load in builds (but load fine in editor)
First one that errors is:```
Unable to open archive file: 5a3bf240d84f9364a8a6616e6c5e36cb/defaultlocalgroup_assets_all_4db2a28a305d8173b91be6d70ef75575.bundle
Unable to open archive file: 5a3bf240d84f9364a8a6616e6c5e36cb/38a1f2d2d5f81899292f497a8e6b92e9_monoscripts_1655fdb55b1eea88e8a8784efa650302.bundle
Unable to open archive file: 5a3bf240d84f9364a8a6616e6c5e36cb/38a1f2d2d5f81899292f497a8e6b92e9_unitybuiltinassets_55411ff6b77a1f1a73611d08d30dec57.bundle
RemoteProviderException : Invalid path in AssetBundleProvider: '5a3bf240d84f9364a8a6616e6c5e36cb\defaultlocalgroup_assets_all_4db2a28a305d8173b91be6d70ef75575.bundle'.
Set the editor to use the archive too, cleaned and rebuild (had to restart unity because the addressables failed with no meaningful error first though?), and getting this error:
Unable to open archive file: 5a3bf240d84f9364a8a6616e6c5e36cb/defaultlocalgroup_assets_all_3d2c948d167cbc5da585467b1e7606c2.bundle
But looking at the addressable report I can clearly see that it exists:
Oh, wow, the code for addressables are a mess
Why does it call GetResourceProvider a dozen times on the same locator
I am trying the addressable tutorial.
What I want to do, is to not have the "Gamma" group in the default profile. So the load asynch of the sprite underneath it will fail.
How can I have that group not be part of one profie but part of a different profile?
Ok, I think I learned how to properly use addressable, and I can now choose to not include an addressable based on profile.
I had to write a little custom addressable build script, but other than that, it's pretty simple
Hi, I'm struggling a little bit to get addressables working for the Meta Quest. They have some documentation on how to add Required Asset Files (https://developers.meta.com/horizon/documentation/unity/ps-assets/#required-asset-files). The way I read it here, the asset files will be uploaded to the /sdcard/Android/obb/[package-name] folder. Does that mean, on my addressable groups, I should set that as the load path? I've tried it, and its struggling to find anything.
Additionally, if I wanted to test it locally, would I be able to adb push my files to that directory?
Thanks for the help!
This is in 1.22 btw
My mesh and material are missing on android, working in editor...
Build > tried Play Asset Delivery and Default Build Script with no success
Also sending settings:
can we convert a game object to assetreferencegameobject through code.
yes, you can get the prefab's GUID with something like AssetDatabase.GUIDFromAssetPath or AssetDatabase.TryGetGUIDAndLocalFileIdentifier then pass it into the AssetReferenceGameObject constructor
Like how simonp.
If I have
AssetReferenceGameObject game;
Game object g;
Void Start()
{
game =g;
}
Like this I am trying to do
Is g an instance, or the prefab itself?
g is prefab.
take a look at the AssetDatabase methods i mentioned, a GUID is what you need to create a new AssetReference
I made it simonp.
You need to load the asset with addressables.
In your case, it might be a good idea to use InstantiateAsync.
https://docs.unity3d.com/Packages/com.unity.addressables@1.14/manual/InstantiateAsync.html
What you are doing wont work in a build given that you are using AssetDatabase which is Editor code.
Oh, I think I misunderstood, you want to convert a gameobject to an asset reference. Are you really sure you want to make that ?
Anyone? :/
I already did that.
As long as you understand that AssetDatabase wont work in a build.
I am importing prefab from Google drive and then converting it to addressable.
Heyho 👋🏻 I am currently planning how to build my game world, it consists of many small islands that I would like to make all on a separate terrain and place each of these terrains in a separate scene. if you now travel between the islands with a boat I would like to load the scene with an island as addressable additive in or out depending on. How does it behave in unity 6 with lightmaps, can I dynamically load a scene with its baked lightmaps, AO and Adaptive Probe Volumes (APV) in and out in a main scene or can the light information not be loaded dynamically from an addressable?
Did they get rid of the Editor Hosting service in Unity 6/Addressables package 2.2.2? I can't find it in Window/Asset Management/Addressables/Hosting
I'm guessing it's just a bug but want to be sure
I also checked Tools > Window and it's not there either
seems like a strange move to remove this functionality, as it was super useful
As far as I know, you can only have 1 lighting setup active at the same time. You can set which one by setting the scene you want as active.
That being said, I suggest that you instead completely unload/load stuff instead. Obviously, if you do not see or have interaction with other scene.
I have experience with this prior to Unity 6. What @frigid stag said used to be correct, however in some version of Unity (I can't remember which) they changed this to make streaming scenes with lightmap data possible. The easiest way to do this is to just open all of your scenes in the editor and perform the bake, with your main scene (which will be loaded at all times in your game) set as the Active Scene.
If you game world is massive and loading all scenes into the editor at once is not possible, another workflow is possible, however it's very tricky. I can describe the way to go about it but would rather not unless you absolutely cannot use the other method.
The above should work for lgihtmaps (which should include AO), Reflection Probes, and possibly regular Light Probes (not positive on this). I have not worked with APV's so can't comment on that. I know before it was not possible to use them with streaming scenes, however I'm not sure if they have changed things in Unity 6 to allow it.
Doing so would result in a 1 single bake data does not it ? Meaning that if you need different settings it would not work. (Ambient Color by example)
Yes, sorry, what you said was technically correct. Only one lighting setup can be used unless you manually change the Active Scene (or there may be a way to change it via code without switching the Active Scene? I cannot remember now). However the user did not mention this, only whether it was possible to load lightmap data from different scenes additively, which is indeed possible and relatively easy to do assuming all of the scenes use the same lighting settings.
Hey, thank you both for your answers. ( @frigid stag @next inlet )
That sounds promising in theory. I currently use Microverse to be able to edit several terrains at the same time, fortunately this also works across scenes, e.g. if you have a main scene and then you have one scene per terrain that is added additively in the editor. I'm going to try this out by performing a bake of the main scene while the additive scenes per terrain are loaded in the editor in the main scene. In general the light settings should not change per terrain, it is an island world similar to zelda windwaker, a simple grid of 6x6 terrains and on each terrain an island is displayed. They are all in the same ocean and have the same sun and therefore the same light properties I think.
A quick update in case anyone comes here wondering the same thing. A Unity staff member confirmed that they removed the Editor Hosting window/service. Too bad, but I guess that's life!
hey im using unity 6 and im also trying to use CCD/Addressables for the first time. I installed both of those packages in my project as well and configured CCD to have my prodBucket selected as the remote thing. in the production environment i made a bucked named "prodBucket" and i uploaded and promoted a file named "race_unknown.png".
heres my code:
https://pastebin.com/AA2ApUcu
Unity throws 2 errors saying it cant find the location for "race_unknown.png"
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Anyone looked at a way to use addressables with strongly-typed keys (without using AssetReferences) ?
why not AssetReferences? that's the default way to do strongly typed keys so it'd help to know what's wrong with them for your use case
For synchronously loading, say, 100 keys, is one call of LoadAssetsAsync() with MergeMode.Union faster than 100 calls to LoadAssetAsync()?
After writing a performance testing comparing the two, and the one call of LoadAssetsAsync() is actually slower!
Batched: median 19.36ms
Non-batched: median 12.46ms
I would have thought that it would be faster since all of the I/O calls would be executed a lot earlier
Does anyone have any thoughts?
Not sure how much you can trust those tests of yours. I/O is can be pretty volatile.
Also, you could probably look what is happening behind the scene. There is a high chance that MergeMode.Union actually results in 100 calls. Merge.Union is not necessary a "batch" function.
I'm running unit tests through several runs with Unity's performance measuring package, are there more reliable ways of testing I/O calls?
I'm using Merge.Union to get the resulting asset of every key, which I assume means that there would be an I/O call for each asset. Are there alternatives to that?
The theory is that the I/O calls is the bottleneck when called sequentially rather than in all at once. My results would show that this isn't the case for LoadAssetsAsync(), right?
Update: yeah, just looking at the profiler, it seems to be serial, (async call, wait for completeion, async call, wait for completion, etc.)
Got a median frametime of 11.34ms for just calling LoadAssetAsync() for every key and completing them afterwards. Guess I'll just do that
I personally, do a multiple loadasset and then create a Addressables.ResourceManager.CreateGenericGroupOperation.
List<AsyncOperationHandle> loadOps = new List<AsyncOperationHandle>();
foreach (IResourceLocation location in handleLocation.Result)
{
AsyncOperationHandle<UnityEngine.Object> handle = Addressables.LoadAssetAsync<UnityEngine.Object>(location);
assets.Add(location, handle);
loadOps.Add(handle);
}
AsyncOperationHandle<IList<AsyncOperationHandle>> asyncOperationHandle = Addressables.ResourceManager.CreateGenericGroupOperation(loadOps, true);
while (!asyncOperationHandle.IsDone)
{
Progress = asyncOperationHandle.PercentComplete;
yield return null;
}
From what I have seen, it was the fastest.
However, I had some issue with a particular asset on Switch (loading one by one was solving the issue). So I believe it might not be 100% stable to do this.
Thanks I'll def check this out
my addressables return null
var handle = Addressables.LoadAssetsAsync<GameObject>("Assets/Prefabs/Trees");
whats wrong?
invalid key exception
Where is the rest of the code. Are you actually awaiting it to be done?
And I am not sure, if you can use / inside that name. At least I would try to simplify it and test
i want to load a FOLDER
it works with a LABEL
but i want an ADDRESS
is that not possible?
You are not understanding how addressables work. They are not based on your folder hierarchy but categorized by labels and groups. If you want to load them, you need to have the reference inside the package that gets build, not the folder structure your original prefab is lying
can i not use this as parameter?
you want to read this to learn how to load them in a correct way: https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/LoadingAddressableAssets.html
this works but i dont see why i have to cast
var handle = Addressables.LoadResourceLocationsAsync("Assets/Prefabs/Trees");
yield return handle;
GameObject[] treesPrefabs = handle.Result.Select(r => (GameObject)r.Data).ToArray();
When i load a folder via a label i dont have to cast & its faster & less code
Can i not do this with an asset path?
Addressables.LoadAssetsAsync<GameObject>("Assets/Prefabs/Trees");
An asset path is a path, with one or many assets in it. How should Unity know, what asset you are trying to load with "LoadAssetAsync"
I am confused about addressable... do I need to rebuild the addressable in order to have any change apply to prefabs? It makes sense, but that's a big disadvantage then just editing a prefab, and pressing play to immediately see the changes.
not unless you're using the "use existing bundles" mode
How i can get an LocalizedAsset in a Specific Locale?
Right now im using AsyncOperationHandle<Texture> op = localizedTexture.LoadAssetAsync(); but that returns me back the asset in the default language
hi im new on unity i have installed the engine right now and i don't know how to fix this problem , i did what the error says but i already have all the system requirements so i dont understand where is the problem can someone help pls ?
I don't think that's addressables related
Hi, i'm testing something out with addressables to figure out some stuff...
Addressables.LoadAsset<TextAsset>().Completed += (var res) => this.Result = res.result; // Loads an 100 mb Test TextAsset
Addressables.Release(this.Result) // Should unload TextAsset and free 100mb of memory space
I'm testing this code inside my Update loop using some if key down logic. It loads the asset successfully, also release works without error but 100mb memory space remains allocated, it never de-allocates it automatically unless i do Resources.UnloadUnusedAssets() which is defined as performance heavy operation in the documentation.
Should i call Resources.UnloadUnusedAssets() when i release anything ? Or is there any better way to do this ?
If I should not release an loaded asset please give me an better approach, i'm just seeking for the best practice
the asset bundle is only unloaded when all assets in the addressable's asset bundle are released
Where did analyze go?
The docs still says it should be there: https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/editor/tools/AnalyzeTool.html
i guess I have to download 2.3 somehow?
it's back now, but the localization rules are not there :|
oh that's just great :) :) :)
so never been able to reproduce, but got crashlytics logs where code doing something like this will null ref on the get component
var go = await _itemPrefab.InstantiateAsync().Task;
var cmp = go.GetComponent<SomeComponent>();
even know the addressable is there
so anyone know a case where i would get a null back from that instead of just a exception if it was not there
yes, that's the normal behaviour, if you want to get an exception for an error, check the exception property on the operation handle
if you usually want exceptions to be thrown instead, it's fairly easy to write an extension method for the handle to wait and then throw if there was an exception
no my comment why is it normal behavior in this case, like what causes it not to return something when i know there was a asset
like its for a asset i know always exists
also so does that mean the addressable operation handles never raise a exception when awaiting the task?
do you mean it's loading from a local bundle so there should be no chance of network errors etc? well whatever the cause i guess you want to log the exception so addressables can tell you itself what happened 🙂
yes, the Task property returns a task that always succeeds but can return null if there's an error
it's not great but that's how it works lol
Yeah thanks for the info, made a experiment to test
Wish it was clearer in the docs since it really goes against assumptions anyone with C# experience would make
unity moves in mysterious ways
Also interested in this use case!
Hello, I want to know if I load many of same kind of assets, how addressable assets system handle its loading,
Let's say that I am going to load PrefabA
5 times immediately asynchronously, then it will load 5 instances or just 1
Thank you 🙂
no, it should load once and you'll get 5 handles to the same asset
Hello, not sure that we should release instance like this, I am going to attach this component to the game object and let it release instance when it is being destroyed
using UnityEngine;
using UnityEngine.AddressableAssets;
public class AssetReferenceReleaser : MonoBehaviour
{
private void OnDestroy()
{
Addressables.ReleaseInstance(gameObject);
}
}
Or just don't having this component?, will addressable asset release instance immediately without it?
You're not meant to use the native Destroy functionality, you're meant to use Addressables.ReleaseInstance, and for unloading a scene, Addressables.UnloadSceneAsync.
Hi, My game is having a pink shader problem when a scene is loaded after downloading from Unity Cloud Content Delivery. Can someone help me to figure it out?
Does anyone know how to disable revalidation on webgl? what are the conditions that trigger the game to revalidate the bundle?
my addressables are not in build
I clicked Build>New BUild
As in i built the addressables
Is there a way to dynamically set addressable LoadPath variables at runtime? (in my case RemoteServerURL)
you can reference a static property in those urls, see the curly braces syntax in the ones above yours
thanks!
Are you using the Local build/load path? If so follow the Local Build path to find the assets (it should be in a sub folder within the output build folder if I remember correctly). If you are using Remote build/load path, it usually outputs the assets to RootProjectFolder/ServerData. Then you need to upload the folder in ServerData to your server or wherever you are loading from.
fixed it
I wanted to post something I discovered recently about Addressables, which particularly effects Shaders and Shader Variant Collections. I could only find vague hints around the internet about my problem, and although the end result of my findings may fall under the "common practice" umbrella, I think this will provide some additional information and hopefully help others understand Addressables/Asset Bundles a bit better.
Effectively, what you should know is that when you build your Addressables, Unity will automatically pull in references to assets that the assets in your Addressable Groups depend on. This is common knowledge. You can avoid this, of course, by adding the dependencies to Addressable Groups; then, instead of pulling in these assets, the original assets will just reference the asset bundles that the dependencies are in. Again, common knowledge.
Something that is less clear (but may be obvious to some), is that when pulling in dependencies, Unity will not be smart about it by pulling in the dependencies once, then having other assets that use the dependencies reference whatever bundle the dependencies were first pulled into. Instead, all assets that rely on the dependencies will pull in the dependencies to their own asset bundle, resulting in multiple copies! Most likely it is necessary to do things this way in order to not slog down the build process, so we just need to live with it.
Regarding Shaders and Shader Variant Collections, when you add a Shader Variant Collection to an Addressable Group, but do not have the actual shaders referenced by that Collection in an Addressable Group, Unity will pull in the shaders automatically to the bundle that the Collection is in. That's great, right? WRONG!? Other assets that make use of the variants do not know about these pulled in shaders! So, Unity ends up pulling in the shaders to those assets' bundles as well.
_ _
All of these different copies of the shader turn into the multiple copies of the exact same variants, at least in RAM (and probably on the GPU as well), which can cause you to run out of memory FAST.
In conclusion, it's not enough to just add the Shader Variant Collections to an Addressable Group. You must always ensure that your shaders are also added! This advice is scattered around the internet, but it was still hard to find a clear cut answer. on how shaders and Shader Variant Collections should work with Addressables. So hopefully someone comes across this and will be left with no doubts.
is there anyone from Unity team is here?
I have posted a question on unity forum, is there anyone here that can help?
https://discussions.unity.com/t/trying-to-understand-how-asset-dependency-works/1568122
That is true for any assets though ? You need to explicitly add dependencies if you do not want to have duplicate over the same dependencies. If you have two mesh with the same texture, you need to flag the texture same if both mesh are addressed.
The documentation is right.
It seem your test is flawed. You actually need to address them and use the addressed asset.
“If you use the same asset both in a scene and the Resources folder, then Unity makes copies of the asset when building rather than sharing a single instance.”
I’m testing this case only, it shouldn’t be affected whether it has been addressed or not.
From experience, it is not the case. I have used the resource folder + built in scene for a considerably long time and never had any issue about such thing. Addressable might change this though.
My bad, it seem I was wrong from what I read. In case of the asset being place directly in the Resource folder, like you did, the scene would refer this particular asset instead of duplicating. However, every asset that is not in the resource folder and reference by both would be duplicated.
I usually only reference the ScriptableObject from the built in scene
Nice day, I'm not sure if this is the right place to ask. If not, please let me know.
Curently, I'm working with loading asset from other project via addressable strategy and facing some weird behavior. My setup:
Project A: Game portal, sure is contained all the codebase of other project
Project B: Minigame (most of this is asset and the game scene)
My 1st try flow:
- From project A, Download catalog of project B.
- Locate the scene of project B by using this
var locations = locator.Locate(sceneName, typeof (SceneInstance), out var list);and useDownloadDependenciesAsyncto download the scene. At this point, I get error:
UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=Assets/gameScenes/02_GameScene.unity, Type=System.Object
2nd try flow:
- Instead of downloading, i'm using LoadSceneAsync() to load the scene by it location, at this time, the scene is loaded success. BUT, some sprite are missing. I try many way to figure it out but have no clue.
Please help me:
- Guide me how to download a scene and all it dependencies in the RIGHT way
- Does any one facing the same missing sprite / asset reference problem, and if you know how to resolve or how to investigate please guide me.
Thanks in advance.
Are addressables finicky around API's? have been wrestling around addressables failing to build because of a line that uses an API I got online. The scripts involved aren't even a dependency or an addressable. Man im comfused.
I even tried emptying out the adressables and just put an empty GameObject there, still the API script is being called out when building the Addressables fail
are you sure it's not just a regular compile error? something that only compiles in editor maybe? addressables does a script build as part of the pipeline so if you have any problems like that they'll show up there
I want to make a prefab for a card of a cardgame which assigns the card art of a specific card once loaded into a scene. It's supposed get a card Id of a card in a deck from a Database and then assign an image from the project's assets with that name to the gameobject in the scene. I was told I could reference Assets using Addressables but what I found online about it didnt make it clear how to use addressables for what I want to achieve/ if it is even possible. Any advice on how to make this come true with addressables or not welcome, ty.
addressables is like a heavy duty replacement for Resources.Load and the asset bundle system, if you're not already familiar with it and just want to look up various assets at runtime by a string name it might be easier to start with that and consider addressables later if you need features like remote content or asset bundle loading
thats what I ended up going with now but I was told Resource.Load will affect the Performance quite a bit
it depends how frequently you're doing it, best to profile and see for yourself since it depends on your game
I see
addressables doesn't really affect the performance that much as far as i know, it's still got to load the assets one way or another, but it is async by default which makes a difference
well right now I'm using it to assign sprites from my assets to a new created card prefab
i'm making a card game and using it only in deckcreator right now
do you believe it will have a significant impact? @teal mortar
well most of the cost will be loading from disk so probably the first time you see each card, after that it should be cached
it depends how many cards there are really
well it will be more over time in the deck editor but there will be a max of 180 cards and an aproximate average of 110 - 140 cards loaded at once in an online lobby.
different cards that is
it will probably be like half of the average loaded at the same time
given most of the cards come in multiples
hey everyone, so i'm very very new to adressables, and i'm having a hard time understanding how it works, so i want to use unity cloud content delivery, because i have a game published to users in the store and i want to send them updates every now and then, i don't want to publish to app store and google play store everytime we do a small ui change or i like to add seasnal themes, so i heard cloud delivery is made for that, and i configured everything with adressables, now here is the thing i have a build on my app on my phone and when i push the changes to release nothing happens, does adressables work that way?? when releasing and every build gets the change ??? please help i need to understand more
Let's say I have 10 prefabs marked as addressable. These prefabs are in the same group but packed seperately. So far I have been using Addressables.LoadAssetAsync to load each one individually. I queue up multiple calls, which creates some conflict between background/secondary threads and the main thread as they fight over file operations and the Persistent Manager.
Are these issues alleviated when using Addressables.LoadAssetsAsync? I.e., if I combine all the resource locations for all 10 prefab assets and just use that method to make one call, will it eliminate the thread conflicts? Or does this method just break down the 10 resource locations into 10 separate loading operations? I guess I'm just wondering if this method offers better performance vs the single asset loading method. I will run some tests but wanted to see if anyone had experience with this before wasting the time to make/run the test.
if they're packed separately it's still got to load 10 separate bundle files from disk either way so i would imagine that would still be the slowest part, it might be slightly more efficient to load them all at once but i don't expect much difference
ymmv of course, profile it is the the only way to get the right answer!
i don't really know what you mean by the thread conflicts though, did you observe performance problems or something? most of the parts you interact with are happening on the main thread and multiple calls to LoadAssetAsync shouldn't cause problems
The shader dependencies work the same as any dependencies. In order to share an asset between multiple parent assets, you need to explicitely make that shader an addressable asset (included in a group). The shader variant collection is basically only needed to include shader variants that Unity does not have direct knowledge of (for example, if you use keywords, or have UI shaders with implicit keywords like UNITY_UI_CLIP_RECT).
There are cases where shaders (or other assets) do not get duplicated, but it's by concidence and should not be trusted. When all groups containing a dependency to the target group implicitely containing the shader, the shader does not get duplicated as it can be guaranteed to be found in the target group. However, if you change the target group so that the shader is no longer there, then all groups referencing that shader will either include a duplicate of the shader OR they omit it if another group they depend on, has it. It's complicated, and unpredictable.
TL;DR: Use shader variant collection to include shader variants you use dynamically and for shader warmup. Put shaders explicitely to a group to ensure they don't get duplicated.
EDIT: The implicit inclusion I talked above actually works in bundle level, not group level. So if your group is split into multiple bundles, only if your referencing asset references somethiing in the shader bundle, there's no duplication. But not only that, some of the Addressables settings might prevent referencing even the implicit assets if you don't include GUID's for the groups/bundles...
if you know you're going to load all 10 prefabs in one go, then I recommend bundling them together. Loading multiple prefabs in one go can be done with either using the asset keys, addresses or labels, and should work fine, but if they share a lot of resources like shaders and textures, there might be some inefficiencies doing it in 10 distinct operations
Thanks. I created a test and preliminary results show that there is virtually no difference between the two methods when attempting to load the same number of assets.
I'm making one change and will re-test for thoroughness, but don't expect these results to change. It seems the batch load method is indeed just a convenience method and doesn't offer any significant optimizations.
While this is nice in theory my tests show that increasing the bundle size increases the cost of several operations that negatively affect performance.
Which is too bad because yes, this is Unity's general guidance. Bundle stuff together that's loaded together. Unfortunately it just doesn't work in practice.
this highly depends on how the references are laid out. For example, if you have 10 prefabs which each reference a bundle that has asset load mode set to "All Assets and Dependencies" then there's change that dependency is loaded and unloaded 10 times - if it was not loaded already
"All assets and dependencies" which setting is this? Is this in Group Setting? I can't find it in the latest Addressables package.
No, if you need to load 10 prefabs at the same time, it will be more perfomant to load them in single operation instead of 10. The fastest way is to have a scriptable object that contains list to the prefabs, and then you make the scriptable object addressable, include in the group with the prefabs. This will load all 10 prefabs in single go.
I'm not at the latest version, but for me it's here in the group settings
They must have removed this setting in the latest version, but I'm almost 100% confident only the individual dependencies from the bundle are loaded.
Also there is no chance that the dependencies are being unloaded and reloaded, as the tests loads all the Prefabs before unloading any of them, and the dependencies are stored in a separate bundle (and thus not duplicated).
I don't doubt that it is more performant, however I am especially interested in just how much more performant it is, because switching to the single operation method will require a lot of work to overhaul my current system.
So far I'm not seeing a major difference to warrant that extra work, and it seems like the single operation just mimics the multiple operation method under the hood, at least for the most part.
This is an interesting idea.
I guess the concept is now you are only triggering one load, and the Prefabs are loaded as dependencies of the scriptable asset?
I wonder though, are you still limited to a max number of Prefabs with this technique? Because once a certain limit is reached, won't the cost of integrating all of those Prefabs into main memory be too high?
We're still in 1.22 and Asset Load Mode is there. Also it seems that 2.3 has it too (https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/ContentPackingAndLoadingSchema.html)
The issue I described is one where your asset references single/few items in bigger "load all bundle" (usually by accident), and if that reference is not kept, then that "load all bundle" is immediately unloaded, just to be loaded again by the next operation.
But again, this is a fringe case and essentially asset configuration problem. Example is that you have an main menu UI bundle which contains some sprites and you make it "load all" to load the whole UI in one go. You then accidentally reference that sprite in your vfx asset, creating an unexpected dependency to the UI bundle. If that main menu UI bundle was no longer loaded (in combat etc), then loading those vfx asset will cause the whole bundle to be loaded into memory, and then unloaded if the reference to is dropped.
Hmm, maybe it's a bug that it's not showing in the inspector then. In any case, it's not a concern here, as I can view the reference counts in the Addressable Assets profiler module and see that only some assets in the bundle are loaded. But I appreciate the explanation.
indeed. It's basically a "asset pipeline paradigm shift" that makes you restructure your code, and can be hassle to do after-the-fact. But just wanted to say that it's a real problem.
For example, in one of our games, we had 100 UI views/panels that were loaded previously by spawning a single UI prefab nested with those said views. Worked pretty good, but was a monolith and took some time to load. We then changed it to loading 100 separate prefabs, and even when contained in the same bundle, initially this lead to insane load time. The biggest reason was how the asset integration in the mobile player builds works, and we were able to make it faster by setting Application.backgroundLoadingPriority to high. But even with that, it was nowhere near the same as before. We then ended up splitting UI prefabs into bigger chunks that load multple views in one go
What I mean is if you have some operation on the main thread, and other operations on the background loading thread or background jobs thread, Unity will lock certain data from one thread.
The other thread tries to lock this same data but has to wait until the first thread unlocks it. You will see Loading.LockPersistentManager or Semaphore.WaitForSignal when this occurs.
It is not a big deal if it stalls out a background thread, but if it stalls out the main thread then you are basically just wasting time, as there's no way to have Unity work on something else while it waits (at least AFAIK).
I will process this (and anything else you add) and respond tomorrow. It's getting very late where I am! Haha.
But I very much appreciate your input and suggestions/ideas. Thanks for taking the time to add to this discussion!
I think the issue here is exactly what I described in the other message. Application.backgroundLoadingPriority is by default Normal, which means that asset loading can only use 10ms of time per frame. If you do everything in one chunk that takes 1000ms, the stall is inevitable (can't do partial asset loads). But if you split loading into multiple operations of 10 (100ms each), then it will mean that there will be multiple integrations happening over longer period of time. Not sure how the scheduling actually works, but if your framerate is 30 FPS (33 ms spent on doing other stuff), then that same load operation would take (33ms + 100ms) * 10 = 1.3 sec. Split to even more fine grained loads, and it actually just makes it even worse.
Good luck with your endeavours. Try to keep your sanity 😬
has anyone faced an issue simialr to this? i download these assets from an addressables bundle, and they have these flashes and flickering in the material
incase anyone faces this in the future, i fixed it by upgrading from Unity 2022.3.13 to Unity 2022.3.54
You appear quite knowledgeable about addressables, I am wondering if we could get a sanity check for our method.
We converted our project to use addressables, so now we have one huge group with thousands of addressables, packed separately. We also ran the duplicate asset isolation script so that generated a group of the duplicate dependencies... So 2 groups in total both packed separately
Do you foresee issues with this? Our load mode is Requested Asset and Dependencies
It's not a good idea to have everything pack separately. You add a considerable amount of overhead to the work addressable has to do.
Ideally, you would group base on their locality. (Whatever is present at the same moment.)
When i want to make addresables for Play Asset Delivery are these settings okay? Because well, not working at all in PAD > Build > Play Asset Delivery (in Editor yes using Use Asset Database as Play Mode Script).
Should I check Build Remote Catalog?
Thanks for the info, yeah, I've been aware of the large overhead for packing separately, right now it's just a choice for simplicity after converting our entire project to addressables and also needing small patch sizes, among some other reasons... but packing by locality is something I would want to consdirer
Did you build the addressables before building the application?
I still would try to clean build the addressables in the group view and clean build the application to be sure, its not a caching issue
Well, thats a whole nother story 😄 But yeh, if your pc is faulty, anything can happen. I wonder where you get the null errors from, that you mentioned
But what is giving you the null error? A script? a debug line?
So your addressables async result is null?
can you show the code you are using?
rather the script itself. But the other statement is not correct 😄 Its either null or not. There is no close to null 😄
!code
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
AsyncOperationHandle<GameObject> loadAddressable = Addressables.InstantiateAsync(reference);
await loadAddressable.Task;
if (loadAddressable.Status == AsyncOperationStatus.Succeeded)
{
GameObject newObject = loadAddressable.Result;
}
Be sure to use something like this to check for the status and await the task to complete. Maybe your editor is just faster in loading it
Please send it here, I do not accept DMs
I like how you ignore the whole !code mention for large code blocks 😄
📃 Large Code Blocks
Use links to services like:
https://gdl.space/, https://paste.ofcode.org/, https://hatebin.com/, https://paste.myst.rs/, https://hastebin.com/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
Its just hard to read large code in discord 😄 thats why its good to paste it on one of those sides. all good 🙂
But from what I see, you are returning gameObject even if its null, so you just continue with a null object.
you never really wait for the task to complete
Yeh, was just reading the docs and the mention this example. but yield will just pause for one frame and continue, doesn it?
I rather would go with the callback or await approach
Ah right, its not the gameobject (the naming is confusing :D) its the asyncoperation.
and that Debug.Log of the Result is null in your logs on runtime, right?
What part gives the null error then?
So this line should check, if its null, right?
if (gameObject.Result ?? false)
but you are checking, is it null, if yes, return false into the if statement and pass that part
any humble soul?
I recommend not using Task but use UniTask. Second to better test you should build addressable content for the platform your editor is, change the "playmode script" to use existing bundles and then play.
also ?? cannot be safely used with unity objects as it bypasses the comparison override that makes a destroyed object == null.
There was also a bug that made URP shaders not be included in addressable builds even if needed in some older 2022 versions
Probably not the problem then, i experienced an issue where meshes using urp shaders were not rendererd or were purple as all shader combos were stripped even if needed
im confused why you have this thing to load assets in such a way
i dont know how many assets you want to load but seems needless to have this complexity on top of AssetReference. I have never needed to do this and i work mostly on mobile.
why dont you test in editor with built bundles and debug to see the loaded result from the async op?
didnt know if that was asset database or real bundles
Build your bundles in editor (change to the platform that matches your pc), make sure it builds without any errors then change "Play mode script" to "Use existing bundles" so the editor actually tries to use those asset bundles and see what happens. Asset database mode wont let you find such problems.
[For me here, remaining on android will result in broken materials as it will try to use android shaders on windows]
I have never had simulate groups work so i dont use it
this is unity 2022 so perhaps they removed it 😆
but having it load real bundles lets you find whats wrong better as it will use the built local bundles and download remote ones too.
you can also use the profiler to see what addressable stuff is loaded/has references still.
Oh if you are releasing the asset it will unload it if it then has 0 references
The docs are clear how this will break stuff if it's actually being used still.
Sorry for the delay in responding; I've been busy the last few days 😅 .
I think if it were purely a matter of the time it takes to load the assets, putting everything in one giant prefab/asset bundle and using a backgroundLoadingPriority of High would make sense; the issue is that we are doing runtime loading/unloading while the player is playing the game. Thus, while it's crucial to make the load times as fast as possible so that the World is not just sluggishly loading in/out assets, it's also necessary that the loading/unloading does not cause frame stuttering.
So unfortunately, for our game which is on mobile, using anything higher than Below Normal is just not possible (maybe Normal can be achieved by optimizing other 3rd party scripts).
Right now there seems to be no other choice but to split the prefabs up into multiple smaller prefabs/Asset Bundles, although I am intrigued by your idea with the Scriptable Assets. However, I do wonder if such a design would not lead to larger Asset Bundle file read times, which is a big issue for keeping gameplay smooth while loading asset bundles in the background. Have you used this design to load assets in/out while the player is playing the game, or only while loading screens are displayed?
Ah, right. In that case loading the assets the way you were doing is fine, but you should check out the asset load timing using the profiler from a build.
We had the problem that the load time increased for the exact reason that Unity loaded the assets as smoothly as possible... During a static loading screen 😅
Yeah, it's a necessary evil that this strategy does slow the overall loading times, even in some situations where the performance is not critical (at the beginning of the game when a loading screen is used for example). However fortunately we can temporarily set the background loading priority to high in these situations to at least improve the time a bit.
do you guy having an issues with addressable assets loading with the changed codes rebuilt build?
i wish the old data can be used, if the codes changes have changes serialized fields, it still should work, for missing fields it can be ignored, but the problem i faced is it cannot be loaded
If you've changed how a class gets serialized, Unity will have no clue how to interpret the old data
if i don't change how any classes getting serialized, just change game logic then it will still working?, as i try sometime it is not 😦
if the class has new fields or renamed fields perhaps FormallySerializedAs can help: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Serialization.FormerlySerializedAsAttribute.html
otherwise you will have to make a new game build and only use the new addressable data with that
Hello! I intend on using addressables and wanted to make sure of something before I start with it.
It's my understanding that it's not necessary to mark dependencies of an addressable asset as addressable themselves as they'll be picked up by the loading process when I load the root asset (Assuming, those dependencies are only referenced by that one "root" asset)
For me, that'd mean that in the cases of scene, I can just mark the scene as addressable and not mark any of the prefabs, textures, etc... in it as addressable. I like that since it'd mean I can keep the addressables list neat and tidy with only root assets
This is correct, dependencies are automatically "pulled" into the group that addressable asset is in.
if a dep is already set as an addressable though it wont and will just reference it. leaving it only to pull in deps can cause duplicates however but you can use the report to find and fix these (addressable reports get made after building content so you can see details about the bundles).
@honest halo i think the report still not convinience to use yet, don't it have any tools to do it automatically?
Huh? If my response didn't make sense go read the official docs as it says the same
edit: the build report will state implicitly added dependencies, warn about duplicates due to this (dupes in many asset bundles) and has a tool to auto add these as addressable to fix the dupes. try it out and see
@honest halo No I am not intend to said that it is not make sense, I just looking for any better solution
Which tool?
Is it in the report dialog ?
read up on how dependencies are managed. addressables uses asset bundles so it works the same
Thanks for the answer!
I try to find the tool to auto add as addressable to fix the dupes but not found, I might have to try a newer version of addressables assets, (my project still on unity 2022)
The report should still list assets that got duplicated in that build so you can fix it manually (make it addressable)
Oh, I see, this is good
Is it possible to limit an addressable group to only accept prefabs of a particular class?
And is it possible to determine load order of the prefabs?
My studio has banned addressables since the last few projects using them all had issues. Biggest one being non-deterministic outputs which meant we would get different hashes depending on what PC builds them (and sometimes even getting different hashes from the same PC). We're talking about having to re-download 100s of MB of assets for a mobile game in some cases.
Does anyone know if Unity 6 addressed this in any way?
When I try to build addressables I get the error: The type or namespace name 'SceneAsset' could not be found .. I am using it as a type in public async void LoadScene(SceneAsset sceneAsset) ... why would it not be able to use this?
Is it because of namespace UnityEditor?
Sceneasset is in the unityeditor namespace
Our studio solved this by having dedicated build machines. OS version will affect the hash, so making sure all the machines were on the same version made a big difference
Yeah, we're doing the same, we even purchased 2 new PCs with the exact same specs and OS just for addressables. Some of our projects are for big clients and tend to have hundreds of thousands of users, so the possibility of a PC breaking and causing everyone to download assets again due to different hashes being generated for the same content is 100% a deal breaker. I guess we're going to keep the addressable ban until that's addressed, I haven't seen any official response on this either. What a shame
!code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/ , https://paste.ofcode.org/ , https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
I'm trying to work on a game with my friend, we have an organization already and I am in it. When I open "add repository" i get this error (we are using version control through unity, not through Git) also is this the right place to ask?
I think even the project name affects it, we used a separate job for building + uploading addressables and it would cause problems. The solution was to disable Crc check for local bundles.
We recently did a big investigation into the Unity Accelerator and ended up also investigating sources of indeterminism in project builds.
The addressable system is pretty robust and is fully deterministic as long as the inputs do not change. However, its determinism relies on the determinism of all the inputs and that's the problem that most people run into.
For almost all assets here is the list of things which are considered:
[unity version, host OS version, host machine cpu architecture, source asset version, source asset guid, target platform, compression/import settings] and maybe one or two other items to make the asset key touple in the internal unity asset database (this is also the same key that is used when using the Unity accelerator) the value is then the imported asset.
In order to reduce the chance of asset re-imports between machines and therefore reduce the chance of addressable indeterminism, the recommendation is to have exactly the same hardware for your build machines and use a Unity accelerator. You might also get good results if you load a copy of previously built addressables onto the build machine before building the latest content (although I am not 100% sure this is required/useful. someone else will need to advise you on that)
We have 2 Mac minis as nodes via Jenkins and we have build jobs for projects. The prod build/addressables job should have been running from the same node but we always got this problem. I presume due to a different project instance for each job.
To be clear, the seperate addressable job was to build + upload remote ones and the catalog. This is why the local group hashes then caused an issue as they were then different (so disabling the crc check and having bundles be named after the group name only resolved this)
@real ventureWhy is it done like this and not like md5sum or similar where it always the same?
md5 or sha calculations only tell you that the content in the source asset has changed. But source assets are not the only input parameter when generating an in-engine asset. Usually an asset is imported for a specific target platform, on a specific cpu architecture, with some specific import settings such as texture compression or format. So all of that needs to be captured to capture the intermediary asset correctly. (Plus the other factors that I mentioned earlier)
For example, if you're building for iOS and android the same texture file would be imported twice for the different texture formats involved, if the android project was built on an Intel Mac, an apple silicon Mac, and an intel windows machine then it would need to be imported 3 times and generate 3 separate intermediary assets into the Library folder.
At some basic level, there is an md5/sha256 style checksum check which is what determines if the source asset contents have changed, but we need to also represent the import settings and some parts of the environment (like cpu architecture)
Hello, I try to create a build script, I got "Timeout after 300 seconds while waiting async operations to finish" message when build addressable assets, how to fix it ?
what is "build script", are you manually triggering an addressable assets build during your player build? You can enable it to be automatically done.
Hi world, I have lsome questions about cloud addressables
I have a very surface level understanding of them, so please correct me if I'm wrong about my approach / understanding
I have an asset from the asset store (specifically Naninovel) that uses sound files
I want to pull these sound files from the cloud (currently UGS) only when they are needed, preferrably through some code so I can control when to get them
Is it possible to... call some magic code to download the files and make them "appear" in the right place, and importantly only download when this code is called, independent of my asset that uses it?
i don't know naninovel but if a third-party asset doesn't support addressables itself it can be difficult to integrate it piece by piece, you can't have a normal reference to an asset stored in the cloud, it has to be an addressables asset reference object (or you need some other code somewhere to fetch it by its key)
and all of that has to be code that works asynchronously of course, since it might be downloading from the web
naninovel does have addressable support, I was just wondering if this "lazy" method was possible
if you can give it addressables references for the sound that should be fine then, the asset will presumably request them to be loaded at some point and then unity will download them as part of that
I see, and it will only get downloaded at the time of request right?
yeah, there are ways to preload things if you would rather have a loading screen up front
i don't do a whole lot with remote addressables personally but this sounds like a good use case for it
okay, thank you
Is there a way to temporarily restore addressable items so that I can bake lightmaps?
I mean to use command lines (https://docs.unity3d.com/Manual/EditorCommandLineArguments.html) to execute build script, I can fix it by not using -quit command
How can I change device to rebuild addressable assets properly?
How can I change adressable loading file path remotely?
you mean platform? If you want to build multiple platforms together I achieved this by doing 1 platform, writing to a file (as platform change reloads code state), changing platform, reading file to then trigger another addressable build.
Oh, sorry, I re-read and I think I have to explains it more, I mean to the situation which I have 2 PCs, then I build a game with PC 1 but later I move to PC 2 just to build addressable assets, but it is not able to download addressable assets files that were built by PC 2, something like that.
You need to give more specific information and provide any errors or info...
It might be able to load remote catalog file, but it has monoscript cannot be loadded error message
That monoscript thing is included in build?
Make sure in the addressable settings that "MonoScript Bundle Naming Prefix" is not disabled @balmy robin
and if your remote addressables are built on another pc to the build itself there is a high chance that local bundle crc checks fail (as the build will download the latest catalog), check the logs for the build to see if bundles fail to load too
Monoscript is not disabled
Yep it is, then how can I avoid it?
I disable crc checks for all my local groups to fix this issue as for a project i work on we had this problem. We had a seperate job to build addressables and upload and it.
if this isnt your problem plz explain it again better
I actually don't know how to build addressable assets properly, when I have to do new build? when to do update build?
I think I have to do new build when it have codes changes
And to make update build works properly, I must have addressables_content_state.bin in the project, so this one shouldn't be deleted, am I right?
I still worrying about broken files, unloadable assets, if it have any way to modify catalog files to change bundle files crc it will better, not sure that can we do it?
This is simple demo, 2 dlc scenes, with one UI button each, and one main menu scene with 2 buttons to load each dlc scene, so clicking just loads single scene and unloads previous (According to documentation at least), but ref count keeps climbing exceeding 3 scenes count, and used assets window shows correct behavior of one scene loaded at a time, why does scene ref count keep climbing, any ideas?
did you release the old scene instance?
It does disappear in bottom left corner, but Im wondering why that scene count only increases
I do Addressables.LoadSceneAsync(scene, LoadSceneMode.Single, SceneReleaseMode.ReleaseSceneWhenSceneUnloaded);, so it should be released once unloaded
huh didnt know it had this arg now but guess its not working as intended?
the old way works at least
int addressableAmount = bopsAddressables.Length;
List<Task> loadingTasks = new(addressableAmount);
float progressPerItem = ((0.98f - objectProgress) / addressableAmount);
foreach (string loadedObjectName in bopsAddressables)
{
sb.Clear();
sb.Append(buildablesAddress);
sb.Append(loadedObjectName);
sb.Append(".prefab");
// Create a task for loading the addressable
var handle = Addressables.LoadAssetAsync<GameObject>(sb.ToString());
var task = handle.Task.ContinueWith(t =>
{
if (handle.Status == AsyncOperationStatus.Succeeded)
{
var result = handle.Result;
catelogueItemsPool.Add(result);
objectProgress += progressPerItem;
return result;
}
else
{
Debug.LogError("Failed to load bops: " + handle.OperationException);
Addressables.Release(handle);
return null;
}
});
loadingTasks.Add(task);
}
// Wait for all tasks to complete
await Task.WhenAll(loadingTasks);```
anyway to speed this up? I wanna load about 300 models. Any tips?
its sometimes a bit faster to load many resource locations at once and then to use those to get the assets. Also better to use UniTask or Awaitable (2023+) instead of Task.
oh why is it better?
It is probably because of it loading many object locations together. You can try loading all the assets together with their address too.
Pretty new to the addressables system and on a bit of a timeline, so I apologize if this is an obvious/common question:
I need to hold the player up in a loading screen until I can ensure they have the latest revision of addressables on remote. Presently I'm doing this by executing CheckCatalogForUpdates and then, on completion, running UpdateCatalogs if the list resulting from CheckCatalogForUpdates is > 0 in length. After that, if there were no updates (or when UpdateCatalogs completes, if there were) I run InitializeAsync.
Superficially this looks like it will work, but I'm finding it difficult to test. I have a temporary testing remote directory set up on another machine on a VPN, and I'm pointing my remote.loadpath there. Testing this in play mode (with the play mode script set to Existing Build), the script will spend a very long time on CheckCatalogForUpdates (about 21 seconds) but ultimately claim there are no updates to be had and advance to initialization. In a built client, the script hangs on CheckCatalogForUpdates infinitely and never advances.
I suspect I'm not getting through to LoadPath and the play mode version is simply timing out, but it doesn't say it is, and I haven't been able to narrow down the problem much. Any ideas?
I am open to testing remote from other places if there is an easier way to do it/one that would eliminate variables. The VPN solution is just what my team had set up ahead of time
As I understand I could simplify this whole operation by just waiting for InitializeAsync and letting it perform its own check (from the documentation it sounds like it does the same thing I do internally) but from my understanding what I've got here should work and it's strange to me that it doesn't.
@fickle spade I think by default the catalog check doesn't have a time out set to make sure to set this.
Second i think the catalog is checked and updated on first use or manual Initialize() so i dont think you need to do it again.
https://docs.unity3d.com/Packages/com.unity.addressables@2.0/manual/InitializeAsync.html
I definitely don't, functionally speaking. The reason I'm doing it now is the team wants some affirmative confirmation if an update is taking place (versus just a check for one), but I might be able to talk them out of it.
I guess if you update or download and update the catalog yourself at the very start that works but you should disable the auto download then
Yeah. I am going to try to refactor to use Initialize anyway, but can anyone confirm a timeout is what's happening here? I really should be able to resolve that directory but I'm not sure what else could be causing it. I'm going to try with initialize only when I get back from lunch.
Is there a way to retrieve the version hash CheckForUpdates is using internally? The crux of my situation is I need to be able to prove to QA that Unity is actually retrieving the correct version and updating as necessary, and to my knowledge Initialize doesn't give me a way to differentiate between addressables already being up to date and an update taking place.
Also im going to have to implement CheckForUpdates in a heartbeat anyway, so I do need to get it working.
the time out is for the web request
ive had it freeze for ever before so its my best guess
Hello, this isnt addressables but its related to memory/loading.
I know when you have a public variable containing an asset on an active gameobject, that asset will be loaded into memory. But what happens if its the same asset multiple times?
Lets say I have 3 enemy spawner gameobjects that all contain the "Spider" prefab. They havent been spawned into the world, they're just being referenced for later use. What exactly is being loaded into memory at this time?
Update on my matter, the only way I could get rid of "the stairs" is by using this piece of code, I don't know why but handle expires at the time of scene unload so I can't release it then, and when releasing it here, scene gets broken, so it's still not a solution
It looks like it works only when using LoadSceneMode.Additive... why Unity why???
It surely cant be hard for them to make it release correctly when the scene is unloaded right?
I think if you use InstantiateAsync() you have to release instance when you destroy it... WHY tf can this not be done for me 😐
There's literally an option to release handle, when scene is unloaded, but this simply doesn't hold true with single mode load, I found a workaround and I'll keep it until I am in a situation when there's need for a true single scene
Scene indicator got higher and higher, and I was unable to unload each bundle on console, so I am sure it holds it loaded
while Additive scene load makes it go to 2 max concurrently
ive only really used additive scenes but i think single scene loading did work as expected. But i use UniTask so not sure if it matters
I usually use it to, but I did more testing today only to find nothing new
first two flat regions are additive loads, and last one is errored because you can't reuse AssetReference's operation
I unload my additive scenes using SceneInstance and Addressables.UnloadSceneAsync() and it seems to work correctly.
I load scenes via await Addressables.LoadSceneAsync(sceneAddress, LoadSceneMode.Additive) meaning i never interact with the async operation objects.
Does anyone know if its possible to reference my game's addressables in an external project? I was thinking on how i could let mod developers reference an AddressableAsset inside an AssetReference.
I'm wondering if it could be possible to have individual Addresses taken from an existing catalog.json be selectable inside an Assetreference
i know you can load an external catalog, but is it possible to load said catalog in the editor and have it show up in the AssetReference's options?
I dont remember how the data is saved in AssetReference but i have the feeling its a GUID because you can assign a non addressable asset and it half works in the UI. So if you can grab the guid and shove it into the asset reference it could work?
edit: its easy to set the asset in code in editor but may need to investigate setting other data manually
aye, i do know AssetReference saves its data at a runtime level with storing the GUID of the asset, alongside it's Type and sub-asset (if one is selected). While at editor level it keeps a direct reference to the asset itself. Sounds like i may need to modify the AssetReference drawer to see if it allows me to set the GUID field to an Address
if the catalog has the GUID then that may be sufficient. sub object name is just that if using a spritesheet for example.
you can have groups not even include addresses so it must work
The catalog itself doesnt seem to have the guids... that or theyre all just one massive string
hmm let me check one
there is this entry called keyDataString but thats not hexadecimal values so i know that cant be the guids
looks to be base64 encoded atleast for the start but not sure how to fully parse it.
technically speaking AssetReference does just call LoadAssetAsync using the RuntimeKey property, which itself is just the GUID (or some extra fluff for the sub-asset)
its in there but im not sure how to cleanly read this tbh
yeah it doesnt look simple to say the least
since LoadAssetAsync in AssetReference just uses the Addressables.LoadAssetAsync. Setting the GUID to be an address instead of an actual GUID might work
tbh idk if i had a fever dream but i swear i once say an Address inside an asset reference field... idk if that was in a specific version or if i'm just silly
you can get the runtime key but its not stored
wym?
I presume GUID is valid to load the asset if thats what its doing. the address you can get with a function but thats editor only
i see
im not 100% but you can always test it out
i know the people who mod my game utilize a system called ThunderKit which itself saves the catalog from my game inside an editor project and that way they have a way to load the assets asynchronously in-editor. i'm unsure how it works exactly but since they have the catalog of the game there they could create a custom property drawer for AssetReference that lets them use a base-game's asset's address... OFC they need a copy of the game to be able to import the game's catalog in the first place so 
huh that is cool, i was hoping there was a way to parse a catalog in editor but seems not. not sure why they bother to use json when the main data is some binary format 😐
another amazing decision from unity
indeed, oh well. something something "we dont support modding"
a shame really, but i hope that approach works
well you can load other catalogs at runtime and you basically have to have a separate project for this (unless you can have many catalogs in a project)
How they expect you to do it nicely is beyond me 😐
I've always wondered too why addressables doesn't integrate better, you have to have a non addressable scene as your initial scene for example.
its really funny how addressables is supposed to be the proper way but there's all these gotchas, which sucks
but yeah i reckon with some of that mod-developer brute-forcing they can get it to work
i've seen them do some crazy stuff
I think because it uses asset bundles and they have the fatal flaw of not being able to reference into the game so addressables only work nice if EVERYTHING is in bundles.
if a bundle can depend on another which is not a guarantee then why cant it depend on assets in the proj already
its doomed forever i think unless they decide to have some revision of asset bundles for newer unity versions that support such behaviour.
I believe this is due addressables being synctactic sugar over asset bundles which seem abandoned
I'd implement modding with NLua, some image import lib, gltf importer etc, since .bundles would require unity to be generated unless I am not aware of something
Im glad they support runtime import/export for glb/gltf as its a great format with useful extensions.
I've had whole scenes with lights displayed via three.js using gltf 😄
Unity has a gltf importer
yea we know?
yea i was complimenting unitys package on supporting runtime use.
Hello,
We are currently working on a Unity project with multiple sub-projects, and we are attempting to integrate addressables from these sub-projects into our main project. We're encountering challenges and would greatly appreciate any guidance or insights.
Our Setup
A main Unity project.
Several sub-projects.
The goal is to create addressables in the sub-projects and then integrate them into the main project's addressable folder.
Attempts Made
Moved addressable bundles to the required location.
Merged the catalog.json files (adjusting internal IDs).
Created a new hash.
Unfortunately, none of these approaches have worked as expected.
Question
Is there a proper or recommended way to achieve this kind of integration?
Any advice or suggestions would be highly appreciated!
Thank you!
What do you mean by subprojects tho? How do you combine them or reuse assets from sub or main in the others?
for subproject we are using multiple git repo and we are connecting these sub repos into a single repo using git submodule concept.
drag and drop an addressable group asset into the groups window and it will be added
sub modules kinda suck id make them into unity packages which isnt hard, just make a package manifest file in the repo root then add the git url as a package.
Let me tell you in brief. I have 2 projects "Project 1" and "Project 2" and created addressable builds in both of them . SO i got "Addressable 1" and "Addressable 2", "Catalog.json 1" and "Catalog.json 2". Now i have put all addressables in one folder and merged "Catalog.json" files (Added "Internal id" of both together). Now i tried to run the build where i have all addressables in same build folder but I am getting "InvalidKeyException".
you can add another catalog at runtime quite easily: https://docs.unity3d.com/Packages/com.unity.addressables@2.3/api/UnityEngine.AddressableAssets.Addressables.LoadContentCatalogAsync.html
the catalogues have binary data so i presume you did not "merge" it properly
The method you shared looks like it loads data from 1 catalog file only. But i want to merge 2 catalog files.
it adds that catalogues data to the current data so you can do many in a row.
Its the only way i am aware of to do this with catalogs. Otherwise it would be easier to add the groups before building
Thank you. can you please suggest me, this link will be fruitful or not.
additionally, we are trying to build addressable local but this link says it will only work for remote
https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/MultiProject.html?
This is because the default "local" path group asset bundles are embedded in the build and ofc another projects bundles cant be done this way.
Loading another catalog at runtime therefore only supports bundles that are located remotely or elsewhere (streaming assets?)
Let me clarify one thing. Our build runs entirely offline. So using "remote" addressables does not mean I have to upload them to a server?
Yea i think if its a path to a file it will still load the bundle
This is minor, but I was wondering if there is a way to apply the SearchContext attribute to an AssetReference?
I know there's the AssetReferenceUIRestriction and AssetReferenceUILabelRestriction attributes, but I don't want to restrict to labels.
With GameObjects I can tell Search to exclude Prefabs inside of models like so:
[SearchContext(query: "p: prefab:any -prefab:nonasset -prefab:model")]
But that attribute can't be applied to AssetReferences as far as I can tell.
https://docs.unity3d.com/Packages/com.unity.quicksearch@2.0/api/Unity.QuickSearch.SearchContext.html
https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/asset-reference-intro.html
Hi, has anyone here worked with AssetBundle encryption (including Addressables) before? If so, would you be available for a chat? Preferably in German, as my English isn’t very good.
Loading asset bundles manually will make decrypting them simple but ofc you need to then load from memory/ a stream. For addressables Im not fully sure but i think you would need a custom provider to implement decrpyting of bundles.
https://docs.unity3d.com/Packages/com.unity.addressables@2.3/api/UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider.html
But if you are doing this to stop asset ripping its not worth it, it can only slow someone down. You cant fully prevent it.
Okay ty, I've already found that path. I know I can't make it 100% secure. I just wanted to make it harder for users so that not everyone can do it.
So, is using the AssetBundleProvider the best approach for now? My concern is about the Catalog.json. Otherwise, I really have to build a completely custom loading system.
This is my current attempt: https://pastie.io/rzianf.cs, but it's still untested because I'm not entirely sure how it works with the catalog.json.
inside the editor, is it a common practice to load assets using Addressables.LoadAssetAsync() on a valid runtime key instead of accessing "editorAsset"?
does anyone know the answer to this question? https://discussions.unity.com/t/addressable-cache-question/1580999/4. do local bundles need/benefit from cache? Need I would say no, but I do have weird behaviours right now. Also seems that enabling the cache doesn't really use the cache (android)
this doesn't sound right... for local load stuff it shouldn't need to cache anything, its mainly for remote bundles 😐
Not 100% sure this is an addressables specific problem, but it seems to be. I've been troubleshooting for the past weekand am at the end of my rope, here:
The other day, the team updated the project I'm working on to Unity 6000.0.34 from 6000.0.23, and it broke addressables building for me. This is a problem only I have, but it affects both of my machines: Any attempt to build addressables results in an immediate failure with the error-
Internal build system error. read the full binlog without getting a BuildFinishedMessage, while the backend process is still running
This occurs whether I build the project normally or build addressables specifically from the Addressables Groups window. When it fails during a full project build, it fails during the portion that processes addressables.
I have been able to find very little on this subject, and I'm running out of ideas. I've:
-Reinstalled the editor
-Removed and Redownloaded the project
-Repeated the above, but on another hard drive
-Launched in administrator
-Completely removed Unity and Hub from my system, restarted, and started from scratch
-Regenerated library folders
-redownloaded packages
-Copied library folders from healthy versions of the project (residing on my laptop)
-disabling burst
This problem does not occur to other teammates, nor does it occur in other projects.
Has anyone seen this before? I'm stumped, and I've got a lot of people waiting on me.
Because of some intermittent success getting my laptop at to at least start building addressables (it doesn't have the RAM for the job and inevitably crashes) I have come to suspect the problem comes from an interaction with riderflow, but that is all I have been able to put together
The relevant parts of the editor log
I think once before i had a very generic error like this. Check if a group is added more than once in the settings asset (via debug inspector view) and also check if a recent merge/commit duplicated an entry.
Something that just came up in my mind... I know that AssetReferenceT's RuntimeKey expects a GUID.
Currently i'm thinking about some mod development scenarios for people using my game, If an AssetReference<T> uses the GUIDS of my game to load the asset. What would happen in a scenario where a secondary catalog is loaded that has the same GUID?
Something along the lines of:
Main game project has asset A with its GUID.
Mod Developer adds a new catalog to the Addressables Catalog, which has asset B that ends up with the same GUID as A
How does addressables' AssetReference handles this discrepency?
I think if you try to load a single asset it gets just one. If you try to load multiple it should return them all. Someone i work with was doing something with loading another catalog and had duplicate addresses.
How you will pick the correct one im not sure (perhaps by looking at the resource locations instead?)
I could theoretically make a helper class that lets you choose from which resource location to load from instead of letting addressables figure it out
thats nice
I think at this point it absolutely has to be the editor somehow. I got it working on my laptop (no idea what changed) copied the entire working project without any version control to my desktop, and opened it there. Build attempts hit the same problem
Not seeing any double-adds
I've re-cloned the project a couple of times trying different hard drives etc
the weirdest part about this is that my laptop originally presented with the same error, but started compiling addressables properly after some background process finished
I was sure I had found the problem when it failed while riderflow was trying to work, but succeeded after it finished
but the more time I sink into this the more that's looking like happenstance
But yeah, in this case this is file-for-file the version on my laptop, just physically moved to my desktop and opened there
then does it change if you remove riderflow?
unity should only be using mono included with the editor anyway unless something is using a system lib thats fucking it
part of what makes me think it is I had a very similar error from not having windows il2ccp installed awhile back
And at this point I've reinstalled Unity entirely several times
Starting to think it has to be system configuration somehow
strangely enough, I can't seem to get rid of it. The only reference I can find to JetBrains is the Rider Editor, which does not seem to be the parent for whatever process runs RiderFlow caching
In any case I don't think it could be the problem given my laptop doesn't seem to mind
Perhaps you need to see what is at AddressableAssetSettings.cs:3042 yourself (you can find the file in package cache) @fickle spade
then next option is to enable generation of sln stuff for packages too and put a breakpoint
"/// Note, that only AssetBundles loaded through UnityWebRequest are cached. If you want to purge the entire cache, use Caching.ClearCache instead."this settles it
I guess de selecting that for the group will fix it?
no I don't want to use cache, I just wanted to be sure that was the case. There might be cases where this might have benefits, not in my case as it increases the used disk space
ive never needed to force unity web requests for local groups so i presume you will be fine
indeed
Given up on trying to get main project addressables to build on my primary machine for the time being since I have them working on my laptop. Facing a new problem: I cannot get content updates to apply to built clients. They work fine in editor, and built clients don't report HTTP errors, but they will only ever use the first version they cache
Trying to test from localhost
any ideas?
hosted the new catalog + hash?
Yeah. Got it into a position where the editor in play mode will fail to an HTTP error unless I have the new ones pasted onto the localhost server, so some part of that is working
and the editor responds as expected to content updates
make sure you have a time out time set for the downloads and what platform is this?
but, while a built client will to load addressables if the server is empty when it is first launched, once it has loaded succesfully once it always loads from cache
StandaloneWindows64
No timeout set right now, although I've tried with one in the past. I'll put one back on
Should I have a custom download certificate handler?
Of note, the built client will report HTTP errors if remote is empty or has been replaced with a new build (as opposed to an update) only if "Use Bundle Cache" is disabled.
otherwise the built client behaves exactly as if it is using local assets
even if nothing ever resides on remote
With bundle cache disabled, it will HTTP error on a totally new addressables build, but will use the old addressables version if given an update
Could my method of testing be invalid somehow? I've been loading a texture2d into a rawimage and editing that texture2d between builds of addressables
Since the built client will 404 (presuming I have caching off) if I include nothing even after a successful load, that tells me the client must not be loading from a cache, but rather somehow retrieving the old file despite the presence of the new one and an updated catalog.
I think it must be a problem with my addressables_content_state.bin somehow
I am pretty sure I'm running into the problem described here:
https://discussions.unity.com/t/addressable-checkforcatalogupdates-does-not-work/1516925/16
Looks like a bug with 2.2.2 with a workaround in editing a conditional in source code? Not sure if I'm missing osmething; been a long day. In any case not sure how to go about it.
Hey everyone, I’m trying again since I didn’t really get any helpful answers last time.
I have a project where the client always has different content. Depending on which server the client connects to, different mods (AssetBundles) are loaded. The main issue isn’t encryption but rather how to properly load these assets.
I’d still like to use Addressables, but how should I handle the Catalog.json (including the idea of using a CustomAssetBundleProvider), or are there better approaches?
The bundles can come from completely random users. Similar to GTA, anyone can add content and use it in-game. These bundles are always created externally from the main game. Later on, I might develop a separate tool to simplify the process for users.
I’d appreciate any tips or ideas!
To add the content at runtime you can load in the catalogue at runtime. As long as the load paths are correct for where the bundles are it should work: https://docs.unity3d.com/Packages/com.unity.addressables@1.14/manual/LoadContentCatalogAsync.html
The next issue however is how to remove this later... I wonder if you can load the same one again later with different content and it will change 🤔
Okay, thank you, I think I'll go ahead and build my own loading system. I can read the AssetBundles once at startup, get the list of what's inside them, store them in a dictionary in between, and then simply load and unload the stuff as needed. I think that's overall the best approach for my needs.
That works but do make sure you store dependencies somewhere else so you load them in the correct order (deps first)
Why addressables doesn't support this better I don't know, dumb decisions once again
Okay, thank you. I'll try messing around with it. If anyone else has smart ideas on how to solve this, feel free to share 🙂
Id try to see what loading runtime catalogues does for you. I've not needed to remove them so it's been fine for us (we had a separate project for handling these different assets)
Okay, I'll give it a try. Thanks.
Hey, im having trouble with a UI element using addressables. I have an addressable scene with a button that I attached an onclick event to, but the onclick function i attached in the editor seems to disappear when i go into play mode and load the addressable scene. anyone having similar issues?
when I go into play mode from the scene with the button the onclick function i added (without loading the scene through addressables), the function stays attached
ok, clearing cache from the groups menu then rebuilding fixed it, nvm
Are you setting addressables to run with a build package or runtime in editor?
Anyone using 2022.3.41f1 or have experience this problem with loading addressables and the script doesn't get bundled? When I load it into my project, says that script it missing. If I manually copy that script over into my loading projects script folder, then it works. It'ls like the bundle is looking locally in the loading project instead of the .bundle file.
Are you trying to store actual scripts in bundles instead of references to scripts?
I don't believe this is supported since the usual consumer is a build which doesn't have the whole compiler toolchain shipped with it. It sounds like you have a project to project thing going on, in which case unitypackages might work better? Transferring them as text assets and doing some import processing to turn them into script files could also be an option.
Well, I was testing out a widget loading style framework: a Portal project and a widget. Both two completely separate projects and the Portal dynamically loads the widget through addressable. All works except the scripts not being captured in the bundle. The whole point of addressable’s is that, to create a dynamic loading framework where projects can be kept smaller and modularized… but don’t include scripts? Hu?
Builds can certainly be kept smaller. I'm not sure this sort of project separation you seem to be talking about is a goal.
https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/index.html
Thanks for the engagement. I find that surprising, I can see from the documentation in what you're saying.. Isn't it strange though that the pipeline would come that far...and then just leave out scripts? It's setting itself up to be an injectable framework, almost there, and then, naw, no scripts.
The issue is its built heavily on asset bundles and these can just hold assets and not any compiled code. You would need to load a lib yourself at runtime to add extra components or other functionality
If you want components that work in 1 project but you build addressables in another then use a package to share these
Which I could download and load at runtime, like addressables?
I thought packages were more static, in that it's only used in design time.
For editor or runtime use? Injecting compiled code on each platform Unity supports seems like a major task. I believe the goal was always just to make asset handling as convenient as possible.
no the package is just for sharing code during editing and not for runtime loading
its funny how mod frameworks can do all of the things you want but unity provide no such way 😐
I get it, I just come from a server backend development where building injectable frameworks is a nice way to build scalable applications that can load functionality at runtime and unload them, very powerful in pluggable frameworks. So when I saw addressable, that process is there.. but then the scripts were left out.
It's like I invite you over for a beautiful steak dinner, pick ya up in a limo, bring ya to my mansion, sit you down to eat...and no steak for you!
Well, they generally don't on the more trickier platforms.
i also probably don't want a game i'm playing to download and execute arbitrary native code from the internet 😨
Kinda tricky on platform that support only AOT. Without the fact that some platform simply refuse to accept code that is added at runtime even if you use dll or other means.
The mod framework exists partially because Unity doesn't offer a way :p
the future of ads
downloading 3000 copies of Code Red directly into the kernel
Hey, I did my research and frow what I understand it is impossible (in a built in way) to load external code (assemblies) for modding support in a IL2CPP game. Definetly not with AssetBundles and maybe with Addressables, but they can only load assemblies that are already in the project and not external in any way.
Is this true or is there also a hidden way to do this?
Above discussion is about the same topic.
event based scrippting it is then
yeah you can embed a scripting language or use visual scripting
I was talking about making a bunch of events and make the mod be a list of "if x then call event y"
sure i'm just saying there's some very existing solid options for doing that kind of thing
like a package for lua?
you can integrate lua https://github.com/Semaeopus/Unity-Lua
lua will never go out of fashion 😎
or research modding frameworks and see if you can do something to make it easier as some are quite powerful
in a quick search it doesnt look like these support IL2CPP
im guessing they use reflection
what boneworks uses should support il2cpp 🍈
does anyone know which addressable api does this compression format conversion ?
coz our project uses custom downloading script to download asset bundle, not sure if the format will be converted successfully
That would be the Caching API, I believe
https://docs.unity3d.com/ScriptReference/Caching.html
Hey, how do get the remoteLoadPath of my current profile in the code?
And how do I overwrite it?
🙏🏼
//Get settings object
var settings = AddressableAssetSettingsDefaultObject.Settings;
var activeProfile = settings.profileSettings.GetProfileId(settings.activeProfileId);
// SetValue on profile and save asset after
You can do most stuff via AddressableAssetSettingsDefaultObject.Settings
if you want to check if a group uses a remote path now that sucks ass (how I did it before is by checking all schemas in a group until their build path id matches the remote id but you have to extract this yourself from the settings asset)
Im getting an empty string from it, but when I debugged and looked at the values in profile settings I couldn’t find the remoteLoadPath (where im getting the assets from)
sorry what is "" ?
empty string
haha no i mean what specifically has the value of empty string 😐
active profile id? the remote path?
oh activeProfile
hopefully you can just check all profiles or hard code the ids
oh shit i forgot, you have to get the fucking profile id with its name
but i looked at one and didnt see any field that have something like this, and i only have 1 profile
so you actually do settings.profileSettings.GetValueByName(profileId, valueName); and to get the id you do settings.profileSettings.GetProfileId("myProfile");
so active profile id is already usable to GetValueByName
my bad
i confused the ID of a profile vs its name
i can get see the profile but no url is there
yea its stored elsewhere cus addressable bullshit
wait maybe i didnt make my self clear before haha,
I want to read the url of the remote load path, that I put on my addressable profile, so I can add "/platform" path to it on runtime, and get the correct bundle for each platform im using.
Ah, you can modify a path at runtime by specifying a function to transform it.
But that's not a good way, you should use [] and {} to have the platform in the paths at build time
i can give an example when a proj opens...
what do you mean by [] and {} ?
im new to game dev
i thought i need different path for every platform since the game would run couple.
in the url/paths in the addressable profiles, [] and {} let you "insert" variables.
[] gets resolved at build time, e.g. bundles/[BuildTarget] becomes bundles/Android
ohhh brilliant
{} gets resolved at runtime so it can be a static property such as bundles/{Helper.path}
I use this for the platform to make it be lowercase cus unity in their great wisdom doesnt do this for build target 😐
public static string Platform
{
get
{
string platformName = "android";
#if !UNITY_EDITOR && UNITY_ANDROID
platformName = "android";
#elif !UNITY_EDITOR && UNITY_IOS
platformName = "ios";
#endif
return platformName;
}
}
i have [] on the build path but the remote is url to unity CCD bucket
Here are my remote paths for example:
the build path is to output em in a folder in the root of the project for a script to then upload to s3
is the AddressableHelper a custom class you made?
yes
but how does unity know to read the values from there?
cus its made to, its functionality they added.
https://docs.unity3d.com/Packages/com.unity.addressables@2.3/manual/ProfileVariables.html#profile-variable-syntax
so just by creating this class in spesific path, unity will read from it?
yea, read the doc page to understand better. If you had a class Foo with public static string Bar = "example.com" then you put {Foo.Bar}
Or [Foo.Bar] , again read doc page
11:55 pm here 🇬🇧
oh, and does that mean i should keep path in env out of the git repo?
er yea i would ignore where remote bundles are output to cus you dont need to keep em (post upload)
are you taking about the upload? i meant the path where i get the assets from
what does "path in env" mean. use the default paths for the local groups
since i will need to write the path for my bucket in the AddressableHelper class it will be exposed
so it may be better to use enviorment variables
well i guess an env var is fine for how you upload but its up to you. The build needs the remote url.
i dont mind it being in the built game, just not in the code in the repo
something for you to decide i guess 🤷♂️
its not an issue usually in games?
i have fullstack background and there it's a no no
anything in the client should be presumed to be readable by a user. The remote url has to be given to the client at some point so someone can read it.
This is why important services that need keys cant just be used in client (safely anyway)
i guess if you want the remote url to never be exposed then you would need a proxy server that is exposed blah blah
or secrets, but it's more about the urls in the repo rather than in the build
well ill go to sleep now, thanks a lot for the help!
Hey I have a few questions if you can 🙏
Ask away
ok so first, im not sure i understand how to edit the remoteloadpath. i updated it on the addressable profile but when i ran the game i get an error (on purpose) and in it i see the old url
i tried to Build from addressable groups -> build -> new build -> default build script
but still it uses the old url
i had some other issues but its a followup haha
Did you set this path on the groups properly? The path should update in the catalog to my knowledge if you rebuilt the content
Not sure I understand
I updated it on the profile, in the group im using that profile
i tried to also clear cash before, but it still wont use the new url
what is play mode script set to? I can only presume its using an old catalog still hence the path not changing
i used existing build
Perhaps the catalog being served was cached and its the old one still
i burned an entire day on this 🥲
check what path your catalog is using too
i cant find the catalog anywhere in the files of my project
this is all i can see
none ^
check the addressable settings. did you enable building a remote catalog there? check the path it uses too
i have just reseted everything related to addressables
ill check
its not enables atm. but tbh im not even sure whats happening, i deleted the ServerData folder which is the remove.buildpath and i can still load things...
i think im gonna give up on this... it's too unintuitive for me ):
nothing make sense to me here... things dont work when they should, and they do when they dont.. and cant find any good documentation for any of this
the build path is where they are output, load path is where they get loaded from (local or some url)
If you have remote catalog enabled it will get that and use that if possible
should..
im still not even sure when the editor is using the local and when it uses the remote
atm. i have a remote.buildpath = ServerData/[BuildTarget] and this folder doesnt exist but still after im doing a build the editor manage to load'
yeah but like i said, i still dont understnd when it uses any of them (remote, local)
Click an addressable group and check there...
in my case it seem to never use the remote values i guess
I know where it is, I updated it constantly, im saying its being ignored
maybe my english is not clear, ill try to explain again,
I updated the value Remote.LoadPath in the Addressable Profiles -> default (profile)
but even after i go to
Addressable Groups -> Build -> New Build it still not using the new value i put there
it seem like its using the local paths when i use the editor
ok i figured out its not using the remote paths when you are on the editor
did you check this?
(i have an editor profile that loads remote stuff from the build path for easier testing)
oh let me see
ok so now it will ask for the remote path on the editor!
works
but i cant seem to load from unity CCD bucket correctly
i used this url:
https://b2f379ed-3701-4dd0-8f41-5f1fcf1d4c69.client-api.unity3dusercontent.com/client_api/v1/environments/production/buckets/4b5408e9-47bd-4381-9177-0269bdb95d32/release_by_badge/latest/entry_by_path/content/?path=/[BuildTarget]
and i got the StandaloneWindows64 at the end of the url successfully, but i still cant find/access the assets and getting 404
even though there are there
i dont have any clue how the unity hosted stuff works, that surely cannot be the correct url to use...
What my work uses is s3
well, it works just fine if i dont include the [BuildTarget]
because i added the files to the root also
ok so i guess ill have to figure out how to access them correctly, and worst case just have different bucket for each platfrom (and different profile)
everytime i feel like i get whats going on it keep surprise me...
are you sure that i get the assets from the remote repo?
i think its getting it elsewhere
i just replaced the url with nonesense and did a new build and it still got the assets
if the load path is say https://example.com/bundles it will load from there
the catalog matters though, its where the addresses and paths are stored
i dont understand
is it loading it from the url or caching it?
because the url right now is not real yet the game loads them correctly
the howww is in there... so how is it able to load the assets?
show me the path its using for your remote catalog
for the remote catalog or in the remote catalog?
in the inspector for addressable settings
this?
set player version override to a value so your catalog names are consistent
It helps when you want to update an existing builds catalog and bundles later
otherwise it will give the catalog a new name and it wont work
but ofc remember if you want different game versions to use different bundles you need to change this version or change the path somehow
managed to load with the correct platform path 🥳
but if i want to build for WebGL, i cant really load it since im on windows.. is there a way around?
if you change platforms in editor it will try to load em but shaders and some textures will be broken
i only have a gameobject with list of scriptable objects on it
i switched to web (before build)
and after i build its actually working now 😮
ill try to run it from browser
but i wonder if it will work.. because [TargetBuild] is determined on build time by UnityEditory bla bla application something, but it will show windows because thats the current platform no?
i cant check anything now because it takes 10 minutes to build for web 😶
damn Brotli Web.wasm... take ages..
its working!!!
yay glad its good now
thanks a lot!!! i feel a little more confident now in addressables hahah
couldnt have done it without you 🙏 🙏 🙏
i've battled with addressables a lot so glad i could help
oh but i have AudioClip in the scriptableobjects in the asset, and i cant play it on the editor now..
it means i must stay on windows build when i develop?
yea cus bundles built for another platform are made to work on that platform only. ofc you dont need to use existing bundles always
the assets get processed for that platform (e.g. build the shader for android so it doesn't work on windows)
so ill develop on windows and when its time to release ill switch and build
you can be on the webgl plat but change addressables back to "use asset database"
brilliant!
and one more question if you will my good sir, about the correct way to use the addressable
im making a small match-3 game and wanted to have the tile variants as addressables so i can update it on the fly, i created a scriptable object that hold the data of the tile (sprite, audioclip, color, and logic and vector list for the matching and poping logic)
and i wonderd how to wrap it for adressable
ATM i make a new prefab of game object with a script that gets SerializeField of List<MySO>
is it a good approach?
er well ofc you can load the asset with the address or use AssetReference to not serialize a ref directly (and thus make a dependency)
I guess it depends how you want to be able to change this data later. If you use unity remote config for example an address there is easy to change any time
i dont think i understood half the terms 😅
i just have list of SO
so if i want to update the list i just add the new SO there and build and upload to the bucket
and in the game i set a reference for it on my gameManager
[SerializeField] private AssetReferenceGameObject tilesList;
eh why not have the list on Gamemanager
why do you need a prefab to then have a list
because this prefab is the addressable
its referenced directly by game manager... is game manager in an addressable scene/prefab?
you ask why not make a list of addresable references in the gameManager?
The data in the "game build" and "addressables" cannot mix with direct references
If your start up scene is "Main" and Main has a ref to an asset, that asset is included in the game build (fully seperate from addressables)
If i put this asset also in addressables, its duplicated! Its in the addressable bundle AND in the game build
ohhh i think i undestand. well i thought that because i dragged it to the addressable group it excluded it from the build
and i never use it directly, i dragged the "prefab" to the game manager from the addressable group
no. If you remove the field "Tiles List" and instead use AssetReference<GameObject> then its okay as this references the addressable indirectly
or doing Addressables.LoadAssetAsync<GameObject>("myAddress")
isnt this the same?
HA you are right my mistake ignore me 😐
[SerializeField] private AssetReferenceGameObject tilesList;
private void Awake()
{
tilesList.LoadAssetAsync().Completed += LoadAddressables;
}
private void LoadAddressables(AsyncOperationHandle<GameObject> handle)
{
if (handle.Status == AsyncOperationStatus.Succeeded)
{
List<TileSO> tiles = handle.Result.GetComponent<AddressableTilesList>().TilesList;
Initialize(tiles);
}
else
{
Debug.LogError($"Failed to load asset: {nameof(LoadAddressables)}");
}
}```
Then back to my original point, why not use 1 scriptable object to reference all the others instead of miss using a prefab?
you can also use tags to load many assets at once with the same tag (labels? i forget)
so creatre a new scriptable object that have a list of scriptable objects inside?
and i thought about labels but wasnt sure how to sync it all and call the Initialize(tiles); only after all the assets were loaded
im sure there are solutions i just didnt go deep into it, is it better to do it like that?
up to you i guess. labels can be useful sometimes but dont bother if you dont really need to rn
atm i see 3 ways
gameobject (mine)
SO with list of TileSO
and seperatly (with label) and await with the Initialize(tiles);
I wanna learn the common practices 🙏
ive used them in the past only to help pre ~~load ~~ download assets ahead of time for stuff
yeah, here its not to help the load, its just to enable dynamic updates
then maybe change it to 1 so with the list and call it a day
is it better than gameobject with a list?
yea it better fits what you want to do, reference a thing that holds a list
If a shadergraph reference a subgraph somewhere else, addressables do not know to find that reference?
I think it's even the material, it always takes the older material version somehow
The material isn't being updated in the addressables, no matter what. When I click it on run time, it doesn't ping the real source of the material.