#📦┃addressables
1 messages · Page 5 of 1
Are addressable catalogs only compatible with the Unity version they were generated in? Figuring out because I'm getting an error while reading the catalog, and I don't want to redo and reupload all the catalogs unless I really have to
not always
Hi all, I'm working on moving away from Resources and towards addressables, for now I just want to check if I can load a prefab in the same way as I was doing before synchronously however I am only getting a null error when attempting to read it.
Below is the code I am using to read the asset, and attached is a screenshot of the Addressibles window itself, I have already clicked default build too. Is their anything I could be missing that would still be not allowing Addressibles to find the asset or throw a NullReferenceException when trying to do so?
AsyncOperationHandle<GameObject> handle = Addressables.LoadAssetAsync<GameObject>("Grasslands: Tree");
GameObject prefab = handle.WaitForCompletion(); // <--- This is the line that throws the NullReferenceException
A bit more info:
If I use the "Asset Database" as the "Play Mode Script" it throws the null error:
NullReferenceException: Object reference not set to an instance of an object
However if I use the "Existing Build (Windows)" I get a different error
System.Exception: Unable to load asset of type UnityEngine.GameObject from location Assets/[ Assets ]/[ Prefab ]/[ Biome Entities ]/[ Grasslands Biome ]/Tree.prefab.
UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>:WaitForCompletion ()
-> Sorry everyone, I found the issue. Seems like the problem is that Addressibles doesn't support paths using '[' or ']' braces
Quite anoying as Resources works fine with those kind of paths, but not the end of the world.
well i question why you are putting such characters in file paths, but this is because it uses this for sub asset getting with addresses. E.g. if i want sprite bar from a spritesheet with the address foo its foo[bar]
though actually this doesn't explain it breaking with the file path but its still weird 🤔
i'm guessing it's because the default key of any asset is its file path, if you give it a different key the file path might not need to change?
Yeah, I get alot of strange comments about the use of special characters in paths. Its mainly a formatting thing, special characters are always ordered at the top of any directory in windows and it makes it a lot easier to visually see the differences between files and folders.
But yeah I'll change this now to remove the special characters. Thanks for the proper explination though on why this is a problem! Its good to know for future reference!
I did try but its still a problem, but its okay ^-^
Second question sorry, does Addressables.InstantiateAsync Automatically clean realease the prefab? My previous code used Addressables.LoadAssetAsync then instantiated manually, and after then called Addressables.Release on the prefab handle. But using the instantiate function seems to kill the object almost imidiatly making me think its doing something simular to Destroy()?
yeah, destroying an instance should release the handle if it was spawned with InstantiateAsync
well, decrement the ref count, rather
No use Addressables.ReleaseInstance()
why? unity dumb
xD
They could have easily added an event or something for addressables to release the instance for you i guess not
oh right it doesn't do it when you destroy it but it releases the handle when you change scene
Tbh, its quite confusing as I figured once the object was spawned in the world Addressable would have done its job and would not need to be involved anymore, however from reading it seems like it still holds onto the object for its full lifetime.
Does this not create a problem with addressables needing to hold references to every single copy of an instanced object in the scene? Say 1000 trees? What benefit does it have to keep hold of these references?
In that case i would just load the prefab and release the prefab when you know all the trees are gone
Ah, is the InstantiateAsync mainly designed for single use gameobjects then?
It could be because if you use an asset from an instance but the instances all get released, it will unload stuff you are actually still using (as it cant know)
Still dont agree with it and think an auto release should be done for instance creation.
Gotcha!
Yeah Ill most likely just go with the prefab loading option then, and then instantiate manually again from that.
Thank you ^-^
Hiya, I am going to be loading in some scriptable objects using addressables, these contain biome generation information for procedural generation so will most likely be sticking around for a while in memory. Is it fine to release the operationHandle once this has been loaded in?
if you release the asset/handle then it will be unloaded... (inc dependencies it needed that now have 0 users)
you can use the profiler to debug loaded assets that dont get released btw
Right so even if I store the result as a seperate variable Addressables will still delete the memory?
AsyncOperationHandle<SurfaceBiomeScriptableObject> operationHandle = Addressables.LoadAssetAsync<SurfaceBiomeScriptableObject>("Surface Biome: Grasslands");
_surfaceBiomeScriptableObject = operationHandle.WaitForCompletion();
operationHandle.Release();
So that I am using this stuff correctly then, is the idea with addressables to always keep the item in memory unless their is 100% no chance it is being used?
For example, say I need to load an image, just to display to the screen in a menu, I have to keep the link with Addressables open until I close the UI again?
the managed object is fine that wont vanish
but if say you load a scriptable object instance to get an texture reference but release the scriptable object, the texture will get unloaded causing graphical issues
You should release these assets when you dont need them anymore, so when what ever is showing them is destroyed/closed
Right! Thanks!
So just to confirm then sorry, is the problem with the managed object loosing the reference due to nesting? As since a Texture2D is a class should it not also be a managed type?
I gave the texture example because the managed Texture2D object would still exist, but its native counterpart + the actual texture on the gpu would be deleted.
Any managed object wont magically vanish untill its garbage collected.
Unity calls these "managed shells" as there is a managed object linked to something else (Texture, audio clip ect...)
You may be aware that gameObject == null is true when the gameobject has been destroyed. But actually the managed object is still there, unity just override the comparison to make it equal null when destroyed.
Ah okay, thats fine! That makes sense then, sorry I just wanted to confirm I understood you correctly. In that case I keep things open until they need to fully be destroyed and then release them at the end of the program (for the biome generation data) or when they are unneeded sooner.
Thank you ^-^
Hope i didn't confuse you with the managed <-> native stuff but something good to understand in relation to how unity works
No no, that was great. I knew about the null example before but it makes sense in regards to this too. My confusion was mainly coming from some post online saying its fine to do it and others not, but you explained why perfectly! Thank you xD
I just updated to unity 6 and I have been trying to import one of my terrain generation scripts into it and I get mesh glitches, it is only wanting to show from the backside even though it gets generated facing up?
nvm, found out it was sky and fog volume that caused the issue 😦
How would you go about copying an addressable profile from one project to another? I figured it'd be a scriptable object but I'm not sure where to find the ones Unity generates, and it's not part of the addressable asset settings either.
I'm getting a bunch of errors when trying to load my addressable assets from a remote source. I'm sure the solution is obvious but I'm tired as hell and googling isn't working for me
Which group should store shader files? I've experienced missing shaders when store it to remote group, can't it be stored in remote groups?
For the love of god I need some help. When I switch my build to Android, the loaded addressable's materials do not load. SOMEONE PLEASE HELP ME I AM LOSING MY FRIGGING MIND
Can I rely on Addressables.LoadAssetAsync.Completed callbacks to be called on the main thread? The documentation is vague on this. In practice it seems to be the case, but will it always be the case, or will I get some rare crash months down the line because it isn't always so?
i believe so yes, i don't remember if there's a doc page that explicitly says so but you can infer it eg from examples that do unity API stuff in completed callbacks without checking
I believe so too. The documentation doesn't mention threads at all, only that the callback occurs in LateUpdate of the same frame if the asset is already loaded.
if in editor, shaders for android wont work in editor. if you want to test with real bundles you need to be on the platform that matches your os and build bundles.
does anyone have any idea on how to pass in this build asset bundle option ? i have looked into the addressable code and it appears addressable 1.19.19 is using ContentPipeline.BuildAssetBundle which gives me no place to pass in this option
custom build script did not provide any option either
Got it working, I didn't see the very hidden warning message telling that. Wasted a good 4 hours on it
Addressables.UnloadSceneAsync(currentScene); //Why does this crash on some computers? I suspect weaker computers (windows)
and how do I resolve this
it just crashes
got a code example for how you are using it? Also how does it crash, got any info?
it just crashes on slower computers. Really strange. The crashlog doesnt show a lot except for addresses that cant be pointed or osmething like unknown function name. But the problem only arises when unloading a scene
Addressables.UnloadSceneAsync(currentScene); so this line causes the crash specifically
dont use async void. use awaitable if on 2023+ or UniTask.
if you use Unitask and do not await the function, use .Forget().
dont use task.delay as it doesnt work properly with unity code. Use the relevent unitask or awaitable delay instead
and a big warning: If you do not await and fail to .Forget() an async function and it throws an exception, the unity console WILL NOT PRINT THE EXCEPTION.
Only a debugger can catch it then or if you catch + log another way
oh it doesnt work properly? So this could be the problem?
well yea its why i just said all this stuff 😐
okay thanks for the advice! I tried all I could think of. I will keep you updated 😄
it's great you gave me some options to try
really big thank youuuuu
Id recommend using UniTask and reading the read me for how to use it
i don't disagree it's not a great idea to use them, but Task.Delay and async void are in no way fundamentally broken on Unity
an exception thrown in an async void method gets printed to the console like any other exception
If the task is not awaited then its quite possible for an exception thrown to not be logged in the console. UniTask solves this specifically with its Forget() function as it will log uncaught exceptions.
Task.Delay() is not wise to use as you could then be executing at some point during a frame that is no longer suitable. Awaitable and UniTask delays complete at the normal update cycle events (Update/LateUpdate etc).
Similarly, if you run code in other threads then these exceptions also will not be logged in the editor console unless you make an effort to do so
async void methods obviously can't be awaited haha, Unity just prints the message itself
that's only on the unity thread of course, but that's true in this case and 99% of cases you want async void in Unity in my experience!
Maybe because i use UniTask soo much i forgot, unitask provide UniTaskVoid to replace async void.
Task.Delay() is not wise to use as you could then be executing at some point during a frame that is no longer suitable
that's not really how it works, it'll run during the next synchronization context update like normal awaits
like most of what UniTask does, i'm pretty sure that's a performance optimization and not doing anything you can't normally do
When does the unity main thread syncronisation then resolve a task delay?
after Update
then yea its at some point during the frame you cannot customise
Is there somewhere with info on how unity handle theirs?
nvm found it
well if you want precise control over when something executes in the update loop there's the Awaitable methods now, Task.Delay is kind of only useful for long delays anyway where you don't really care about that 😄 my problem with it is just that it's expensive and uses thread stuff so breaks on webGL lol
UniTask delays work with the update loop so perhaps they would still work as i believe they get "checked" each time if the time has passed or not.
that's more or less how Task.Delay works in this context too, it's just implemented in a way that's not particularly suitable for Unity
Yea. Dunno why I had the impression that unity didnt handle Task well but maybe that was back on like 2019 or somethin
in the end i figured it out myself, it is not opened by default, have to use addressable as embeded package and modify the source code to add this option
Hello, I'm working on my project to bundle scene (level 1 and level 2) using asset bundle. When load scene 1 and 2 seems fine and work, but when I reopen scene 1 it gave me this error
The AssetBundle 'Memory' can't be loaded because another AssetBundle with the same files is already loaded.
UnityEngine.WWW:get_assetBundle ()
does anyone know how to resolve it?
IEnumerator LoadSceneFromBundle(string bundleUrl, string sceneName)
{
if (!remoteAssetBundle)
{
using (WWW web = new WWW(bundleUrl))
{
yield return web;
if (!string.IsNullOrEmpty(web.error))
{
Debug.LogError("Failed to download AssetBundle from " + bundleUrl + "! Error: " + web.error);
yield break;
}
remoteAssetBundle = web.assetBundle;
}
string[] scenePaths = remoteAssetBundle.GetAllScenePaths();
if (scenePaths.Length > 0)
{
// Load the first scene in the bundle or find one matching sceneName
string sceneToLoad = scenePaths[0];
foreach (var path in scenePaths)
{
if (path.Contains(sceneName))
{
sceneToLoad = path;
break;
}
}
// Extract just the scene name from the path
string sceneNameOnly = System.IO.Path.GetFileNameWithoutExtension(sceneToLoad);
LoadAssetBundleScene(sceneName);
}
}
}
public void LoadAssetBundleScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
Not really an addressables question as you don't need to manually load/unload asset bundles when using it.
The error is pretty clear though that you are trying to load a bundle while one with the same name is STILL loaded. So either rename the bundle, un load the other one or don't try to load this at all.
also WWW is deprecated and has been for ages so stop using it 😆
if I'm using addressable should I add scene on build setting also?
No because it will exist twice otherwise
Thank you for your suggestion
Finally got a chance to get back to trying to straighten out Addressables. Since last time I posted looking for answers, I've gotten addressables to work as expected in a clean project on the same versions, and worked at considerable length with a teammate who hosts our build servers to set up build and update workflows and temporarily host addressables on the local network.
Our efforts have been enough to get addressables in the primary project to load correctly for the first player and full addressables build pair (we're building separately in all cases), but addressables updates are never received by built clients.
Earlier today I lucked out on some google-fu and discovered that built projects receiving remote addressables cache them in locallow/unity/[company]_[project]/, and separately cache a copy of the catalog in locallow/company/project/com.unity.addressables, next to the log files. I then noticed that my clean testing project (in which addressables update correctly) is successfully saving this copy of the catalog, but the main project is not. Despite successfully loading the first full addressables build and saving it to to the company/project directory, no copy of the catalog can be found.
I assume this discrepancy is responsible for the main project not detecting new addressables and updating, but so far have not had any luck determining why it might be happening. The main project and empty testing project are configured identically as far as I can tell, with the only differences being more asset groups in the main project, and the fact that my testing project is built locally, and main project is being built remotely on my coworker's build server and pushed to steam by command line.
Any guesses as to why this might be? Could we be missing a step in the command line part of the process?
I can find no exceptions in the build logs or player logs, and have verified through said logs that the RemoteResourceLocator for the main project is coming back with CanUpdate true, which was a pain point in the past.
alright so I'm getting a RemoteProviderException : Invalid path in AssetBundleProvider error when trying to load remote addressable assets. I've looked at other forum posts and the errors seem to be related to stuff like getting the paths wrong, but I know the load paths are correct because I'm loading from the same location, and I know the assets are there
Are you uploading the new catalog and hash file together? Also is the "version" the same value?
Do remember also how some hosts have caching that won't serve the newest file always such as aws cloudfront
Host caching shouldn't be an issue; we're just hosting over a VPN right now, so effectively a LAN server. Catalog and hash should be going up together, but I'll double check with my co-worker monday
Unfortunately the server side of this is going down across the country from me
Yeah, hash, bin, and bundle files are stored together. The catalog bin and hash pair match in name
I've left the argument blank there, so it's a date stamp at the moment
Last game I worked on that used remote addressables a lot had the catalog ver set to 1 always and we put the app ver in the path instead to "version" the content.
Can you confirm if the catalog file name is the same as before when you go to "update" things? I don't remember if it will keep the same name if you do a content update build or not.
Left default, content update builds introduce new catalogs with the new timestamp
which I verified to work alright on my default testing project
My running theory is that our content_state_bin is getting improperly replaced between new addressables builds and content update builds. Hopefully about to confirm or exclude that theory.
Weird question: Do you know what Unity does if you try to run an addressables content update build with no addressables_content_state.bin file from command line?
We tried deleting that file and running an update build to see if it would fail, but it didn't, and the build log claims to have accessed the file in the usual location. Trying to determine if it's a version control problem
Im not sure, even though we used jenkins to do addressable builds to then upload we never used the content state bin (I actually added something to fully delete the Library/com.unity.addressables with it too as it would cause issues with built content.
Interesting. Were you doing full addressables builds every time and just overwriting then?
we rarely needed to update content for a released version but when we did we built it the same (mobile platforms)
worked fine. and seeing as we used jenkins jobs this seemed the best way
Yeah this is what we ended up doing
Seems to work fine
I'm 99% sure the problem was with the state.bin getting lost somehow between builds on the build server, but this is definitely the simpler move
Glad you got something working, dont think they designed it with people automating builds in mind
@honest halo I did some testing. The problem is using the additive scene mode
if (safeMode)
currentScene = Addressables.LoadSceneAsync(sceneIndex.ToString());
else
currentScene = Addressables.LoadSceneAsync(sceneIndex.ToString(), LoadSceneMode.Additive); //this doesnt work on some devices and idk why
Are you using this scene index as the address then? I see no reason for it to fail, I use additive addressable scene loading on mobile a lot
it's really strange. Only on some of the oldest laptops I have it doesnt work. I have been trying to figure it out as well
What's the error it gives? (If it even does)
it just crashes and the crash report talks about not able to appoint some kind of addresses. But nothing specific, just cryptic
Post it if you can
The thread tried to execute an invalid instruction. Thats the exception. 0xc000001d. I will post the full crash log in the coming days when I reproduce it again on the older devices!
Hmm wont open this dump but an invalid instruction error sounds like something really went wrong. I presume this is using il2cpp?
Do you know if there's a trick to live-updating addressables bundles? We've got my test case (A little sprite I change the color of) working for all restarts of the game, but not bundle updates taking place while the game is loaded. I'm a bit confused as to why not. I've verified through debug prints that the update is detected, downloads, loads in LoadAssetAsync, and gets applied to the texture with rawImage.texture = obj.Result;, where Result is the result of LoadAssetAsync.
Off the top of my head, I'm guessing it has to do with releasing
Well are you releasing the asset when its not used anymore? you can use the profiler on dev builds to better see (if you have the build report)
So far I haven't been releasing at all just in interest of getting everything working. It does make some sense to me that I would have to here, though. Can assets be released as soon as they're loaded, or do I have to keep them around until they aren't being displayed?
if you release when its in use you would probably see the texture break. you should release when that asset is not in use anymore. It lets unity unload assets and whole bundles
Hmm, any way to force everything to release when an update is executed?
I apologize for not just testing this stuff, but I'm in a somewhat unfortunate testing position because I can't run play mode with existing build, in turn because I can't build addressables locally. I get a completely unresolvable SBP error for some reason, so I'm reliant on the build server's twenty minute turn-around
I think this stuff is tracked in the profiler even when using asset data base mode. i've had vague errors before when i had assets duplicated in groups (due to bad merges)
but id get on keeping an asset ref and trying to release when you can
hm, alright. I'll poke around and update with whatever I learn. Our situation is tough to handle discreetly because we have a bunch of menu overlays that are alive all the time, so some things we need to be able to swap to new versions in-place
you would need to have more bundles then (either more groups or split up more) to have the chance
Does anyone know why Unity might be stripping all URP Terrain lit shader variants that include the INSTANCING_ON keyword?
Terrains that use Draw Instanced are included in my Addressable groups. I've added all terrain related shaders/files to addressable groups. I have even created a Shader Variant Collection that includes the correct variants and put that in a group.
Nothing works except to set Instance stripping to keep all, however I'd rather not do that because it increases build times.
Instancing works fine on everything else, including on terrain that I add to regular build setting scenes. Why doesn't it work for the Terrain in addressable groups!?
I am using Unity 6000.0.24f1.
I think I found the fix for this issue in case anyone stumbles across this problem. The material you are using the URP/Terrain/Lit shader with does not appear to be correctly configured by Unity when you enable Draw Instanced on the Terrain.
For this reason, I find it strange that it works correctly when building the Player and the terrain is inside a Build Player scene. I assume there must be some sort of scene processing code that detects that Draw Instanced is enabled and configures the material correctly, which doesn't happen when building Addressables.
To fix this, you can click on your terrain material and set the inspector to debug mode, then enable the Enable Instancing Variants setting:
If you are using the built in TerrainLit Material from the URP package, note that you won't be able to do this. You will need to create a new Material in your project that uses URP/Terrain/Lit.
Hello, i think i might have ran into a bug. but i wanted to confirm first.
My editor crashes whenever i build adressables, after checking all the groups i found the infected scene, then after examining the all objects i fount out that the culprit is the PanelSettings asset of the ui document. without it everything builds just fine. with it in scene or in group it causes a crash. is it a bug?
also how are you guys using addressables with ui toolkit then?
the log is attached, thx
thats wild, think you need to report this so it can get fixed as im sure its not desired for any crash to occur during this process.
well on my way creating a project to report the bug, it seems like it got included just fine?! what could it be, im using same editor and pkgs version.
the crash mentions writing a serialized file so its surprising that it actually completed. Are you sure the bundles are valid?
yes thats what im going to check now. even tho i rebuilt all my addressables data folder yesterday.
Hey, is there a known issue with Addressables which causes sprite files to be loaded twice?
In the editor, everything works fine and my sprite asset that gets loaded by label is only treated as one file.
But in the final exported IL2CPP build, it looks like the same file is loaded TWICE. Is it possible that this is because it's type is 2D/Sprite, and Unity internally generates a "Sprite" class for it?
what are you seeing to make you think its loaded twice? A sprite defines an area on a Texture2D so all it really loads in asset wise is the texture
Because I added logs to double check.
First attached image is editor. Second attached image is standalone IL2CPP build.
I am loading the assets in by label
If you think it's helpful, I can paste the code
This "3_whisper_wagon_logo" is the problematic asset, it's a .png file that is marked as 2D/Sprite (Single mode) in editor
This issue doesn't happen for the other .png file which is left as default (Texture)
yea id be interested to see what this is coming from.
you can use the addressables profiler module to actually see whats loaded and how many users it has
requires the addressable build report and 2022+
image on the left has the "arrow" next to it
that's what gets generated when you change pivot or something similar with the 2D Sprite Editor plugin
the image to the right doesn't have it and therefore doesn't have this problem
so when you expand it, there's technically "2" images:
Yea, a sprite will always have either a single sprite inside it OR multiple. A texture is just itself, a texture.
do you think this is an addressables bug?
especially since I can't reproduce it in editor
or maybe it has something to do with IL2CPP
i dont know cus you havent shown what you are using to log this info
Sprites are technically sub assets of the main asset too. you access them usually by doing address[sub_asset_name]
if you check in the inspector it will show this sub asset address
this is the entire code for the asset loader if you find it interesting
you shouldnt need to do .Task.AsUniTask(), should be able to await it directly.
secondly, you should specify a merge mode when loading many asset locations (may solve this problem)
huh, I can await these and i use UniTask with addressables
it may be an extension method in another asmdef
Yup, so found the issue. In editor, only one instance of this .png is loaded of type UnityEngine.Texture2D.
But, in the standalone build, there is an extra one with type UnityEngine.Sprite
I was hoping a Unity staff member might see this and explain what I'm missing
Still not sure how to fix this other than remove duplicates, or save them by type, idk
If you use a merge mode to combine and specify Sprite as the type it should be fine...
I'm encountering a pretty weird issue; when I build for a certain profile, my Addressables come in at 1.76gb. If I switch profile, its 2.88gb, sometimes as much as 3.6gb. Nothing is different between these profiles, aside from their build and load paths, and even they are almost identical. Any thoughts?
UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown. No Asset found with for Key=Academy. Burgundy. Key exists as Type=System.Object, which is not assignable from the requested Type=GarmentDesign.Fabric
So does this mean I need to modify the entry itself to be a different value type, or does it mean I need to change the retrieval operation to return a generic object, then use an as keyword to get the correct class type?
looks like you are already trying to get it as System.Object, which is not the same as UnityEngine.Object.
You should be able to get the asset as a Unity Object as im pretty sure i've done this before.
then you can do if(thing is Sprite sprite) or whatever your asset types are
well what I want is to get the type as GarmentDesign.Fabric.
Here's the operation I'm using:
AsyncOperationHandle<Fabric> operation = Addressables.LoadAssetAsync<Fabric>(key);
GarmentDesign is just the namespace for the Fabric class
what does Fabric inherit from?
ScriptableObject
I know that's the type of the original object being saved, so it's not like I'm trying to return the wrong thing
huh that is strange then. is monoscript enabled in the addressable settings?
is this needed for building or loading?
helps will bullshit like this 😆
well I'm building the addressables in one project, uploading to a server, then retrieving them remotely in a different project
keeps the repo size down by having two different repos
set "MonoScript Bundle Naming Prefix" in settings to something to see if it helps. ive had issues before were certain monobehaviours failed to load
could be your classes are different in some way? how do you sync the scriptable object types?
id have a package as a git repo and build from the main project
you mean putting all the addressables in a separate package, then installing that package into the project, so there's two git repos but only one project?
That might work but it'll be a pain in the arse, I'll try setting the monoscript stuff and see what that does first
thanks
well im not sure how you are maintaining consistency with your types then atm
a package is the best bet, you can add a copy in Packages/ to make it editable
I just copied the script from one project to another, and then deleted any code that was causing errors (obviously keeping the fields intact)
it worked before
I wonder if the meta class needs to be the same
or the asset filepath
seems quite un reliable to me.
yea they do, the meta files for all cs scripts contain the GUID which is whats used
soo yea, use a package 😐
aight I'll try ensuring the meta file is the same
huh so I just realised that when I build the addressables, it's not actually building new bundle files to match the catalog
So I've set the build path to the following for my addressable group. When actually built the catalog file ends up here, but it generates two new folders to put the bundle files in. Any idea what's causing these new folders to be created?
Based on the folder names specific to this project, it must be something that was set up before I started working on this part of the project, but I've already checked everywhere I can think of for assigning build paths.
my remote build path is {UnityEngine.Application.dataPath}/../bundles/[BuildTarget] as i didnt know where a relative path would go but this is consistent.
Has anyone had trouble with addressables failing to load after LoadAssetAsync comes back successfully?
I've been putting together a nice general system for progress bars on downloading and loading operations, and deliberately bogged down the download process with a few extremely large image files
I'm using this pattern to launch the loading tasks:
public async Start() {
AsyncOperationHandle<Texture2D> handle = Addressables.LoadAssetAsync<Texture2D>("mytexture");
await handle.Task;
// do stuff
}
and a separate coroutine that accepts the task as an argument for updating progress bars. The coroutines themselves do nothing except update progress bars (so they can be optional) so I don't think they're relevant here.
This works great for "normally sized" files, but I noticed the giant test images I introduced to slow the download process won't populate after the await the way small ones do. I've got a debug print in there confirming the operation has succeeded, but when I go to place the images, I get nothing the first time.
It happens that I also introduced an update heartbeat though, and that re-fires the load operations. It shouldn't, but I haven't disabled that part of it yet. The important thing there is when the heartbeat re-launches the load operations, the giant images load instantly.
The test images are like a quarter gig each so not exactly the sort of thing you would use in production, but it worries me that they aren't reliable.
how are you confirming it's succeeded? in your example code you're only waiting for the operation to complete, and it might have failed at that point
the Task of a handle won't throw an exception if one happens, you'll have to check the Status or OperationException properties of the handle
apologies; that was an appreciated example because Unity had just hit me with a total system lock
I'll try and spare you Discord code formatting, but the deal is I've got an async function that wraps LoadAssetAsync so the results can be tracked for later release, among other things. Within that wrapper function, I run LoadAssetAsync, start the coroutine for monitoring its progress, and then await the AsyncOperationHandle.Task from LoadAssetAsync
Once the await is concluded, I test if the task has been completed successfully. If it has, I populate the addressable asset (in this case an image) and write some stuff to the console
That task does complete succesfully, and for reasonably sized images it will go on to populate them just fine. But for very large ones it will complete succesfully (debug printing from Task.IsCompletedSuccesfully), but the actual result will silently fail to populate
see above 😄 the Task being completed successfully only indicates the operation is done, not that it succeeded
Don't forget this setting. UniTask extensions will "forward" the operation exception (when the op is awaited directly) so this option is not needed in that use case
I suggest using Awaitable or UniTask.
so I'm a bit confused by the wording, are you saying 'this path I use is consistent' in the sense that it's reliable, or you're saying that what's happening on my end is somehow consistent with how it happens on your end?
It was to make sure i knew the path was right on my machine and our build jenkins.
Hello, I have a question about cloud content delivery. Can anyone suggest alternatives to Unity Cloud for this purpose? I want to be able to update content (such as adding scenes, prefabs, etc.) so that users can download the addressable assets online and keep them updated. Thank you!
you can serve the assets from any web host such (e.g. aws s3)
On S3 you need to pay for storage ($0.023/gb) and for bandwidth ($0.09/GB after the first 100GB/month), and both are more expensive than going with CCD where the storage is free and we charge $0.08/GB for bandwidth after the first 50GB/month
https://unity.com/products/gaming-services/pricing
https://aws.amazon.com/s3/pricing/
Everything you need to launch, manage, and operate your game – at a fair price. Our products are designed to work for AAA studios, indie developers, and everyone in between.
hey im just saying what ive worked with before 🤷♂️
Oh yeah, it's definitely a valid option
🤔 but it's weird that even catalog.bin fails to download but catalog.json doesn't after I enable json catalog. Also a local build works fine.
I was wondering if the Unity shareable build has some server limitations
could be for security reasons that some files cannot be served but it 404's anyway to not reveal the file structure
yeah possibly 🤔 ok thanks for your help!
Indeed, the same addressable settings but deployed to CCD seems to fix it 👍
np, its confusing when the response code is 404 but its a common practice for this kind of stuff (e.g. private github repos)
This might be a potentially dumb question. Right now we are building our game with jenkins and that uploads the addressables to our cdn, after that they are downloaded to the client running on the devices. How can I do a local build that will not rely on having the addressables be uploaded to the cloud ?
You need a second profile where your "remote paths" also point to local
I haven’t really worked with addresables what is a profile and what is the local path
Thanks
@honest halo sorry but I’m still confused would the addressables live on my pc or the phone ?
Er be embedded in the build. Local would be the same and remote will also be local
So when building the addressables as part of the local build step I need to use the profile where remote and local point to the same thing right ?
hey fellas, hope youre all doing good! I have a question related to LoadResourceLocationsAsync:
I am making my own wrapper class around the addressables system, and i am met with a problem where i dont know if what i want is possible. i have a Dictionary<object, object> where i store all the results from my load operations, meaning i cache the loaded assets to have better manipulation around them. My Dictionary<object, object> values are (key = either the runtimekey or assetreference, whatever i used to load the asset) and (value = the resulting object) I need to obtain all the results of a load operation when using a label, but that offers a problem where i do not have unique keys for each value. Is there any way i can use the label to target at the runtimekeys and use them to individually load the assets?
I took a look at LoadResourceLocationsAsync, and thought i could use the resulting list of locations to load the assets, but it results in multiple errors. If you guys need any more info let me know!
Its probably not possible as you can disable addresses being included in a group so there is no guarantee an addressable asset has an address
assetreference kinda has the same issue, it may not have a "runtime key" due to this.
You may be trying to do something you should not with addressables tbh, why keep all these things? what good does it do?
through rigorous testing i have found that addressables' internal caching is (not by much, but it is) slower that just me manually caching assets in a dictionary and just returning them. On top of this, since i have the object (as well as the handles) i can release the objects without making a big mess in whatever other project i work with that uses this wrapper. I do agree that it might be a bit overkill, but i have been able to increase performance with this implementation in every other case, its just the labels that offer this impediment i am at
Whats the “right” way to use addressables? Meaning organizing and loading them
I’m still completely lost as to how fully embedded the addressables in my dev build
the code seems to be always be calling Addressables.LoadContentCatalogAsync but reading the docs this seems to be for additional cataogs, unless this is also used to override the main catalog
I'm just hella confused
Ok it seems the content is split into multiple catalogs I found the code that builds them. I’m trying to build them with a profile that has remote be the same as local and BuildRemoteCatalog to false
so unity builds local addressables to the Library folder and then it somehow knows to transfer them to the streaming assets folder when doing a buld. Is this assumption correct ?
It depends on the platform. For ios and android for example, they are within the built app apk/ipa/aab
Sure, I just noticed that the addressable runtime path is the same as streaming assets on android at least. So it is pretty much guaranteed that the build addressables from Library end up in the build right?
I can only really confirm for android/ios but yea those always work in my experience. I presume for other platforms like win it will copy the assets to be where streaming assets work from 🤔
Ok cool, so now if I side step some logic in the client that pulls in remote catalogs it should just work
Since the catalog I build is around 22mb while the catalog in library from the CI is around 0.9 i presume mine holds all the assets and the additional remote catalogs are not needed
Yea as long as the load path goes to the correct bundle its gonna work
The load path from the profile ?
yea, whatever the active profile was when it was built
I created a new one where the remote paths are the same as the local paths
I believe in the prod profile the remote paths point to the cdn
yea should be fine. id use a prod and dev profile too to seperate stuff and also an "editor" one that i used to make it all local (when i wanted to test using "existing bundles" and not upload anything)
Hi everyone, I'm working on a bit of terrain generation and am loading in some game objects (like trees and such) to fill the terrain.
Right now I am currently reading the spawn requirement information and the gameobject through scriptable objects. These are then converted into a form to spawn and respawn based on whether the player is loading the specific chunks.
I was wondering, would it be better / more memory efficient for the prefab objects as the string address of the addressable, or just stick with the reference to the game object.
Would it be worth using addressables for this or not?
If spawned a lot its probably better to fully load the prefab/asset in once then use that. Does mean however you need to not release it too early.
Gotcha will do
I suggest this so you can avoid the cost of "finding" the asset each time when really it only needs to be retrieved once. I'm sure its cached but it will be faster this way.
Im not sure if AssetReference<> will directly cache its asset but if so thats probably a good choice too.
Would AsserRefernce be used for when I am directly referencing it with the GameObject prefab?
I'll do some reading into it, just want to make sure I understand what you mean. ^-^
Help request:
I'm using addressables in a project where I have a group containing about 40,000 tile assets, and it's causing me serious load time issues - whilst all of the project's assets only take about 250mb on disk, a call to LoadAssetsAsync for all of the tile assets in that group takes 3-4 minutes and pushes the memory usage up to 5gb. (This is for the built project - in the editor things are much faster as I rely on AssetDatabase - I had to as addressables was causing my times to enter play mode to exceed a minute)
It seems that addressables simply can't handle that large an asset group very well. However for my use case it's by far the most convenient arrangement - I need all tile assets at all times (it's an open world 2d game), and in total they shouldn't take up that much memory anyway.
I've tried a few things like making the group uncompressed and turning on the UnityWebRequest option, but neither helped.
I'm considering just ditching addressables entirely for the old school Resources.Load approach, as it feels like it's doing more to get in my way than to add value.
Assuming I can't or don't want to change the way I'm managing tile assets, what options do I have to get addressables to play nice with this situation?
Are these all in 1 group and 1 bundle currently? How large is the build bundle? It may be simply too much to load and parse at once so having either group by tag or be individual may help.
Btw what is the resolution of these textures
In the build the bundle file was about 250mb. The 40,000 files are just tile definitions, so they're 1-2kb each. The textures are packed so there's a lot less of them (a few hundred).
I've been testing loading via resources.load this evening and the difference is night and day - the built game can load all the assets in a few seconds now.
Seems to be a bit of an ongoing issue with addressables, I've seen forum discussions by others noticing LoadAssetsAsync being very slow. Not sure what it does under the hood to make it so.
Perhaps it's worth reporting as a bug. Tbh the asset bundle system is old and I bet flawed in many ways
I'll never get over bundles being unable to ref assets in a build/resources
It does all feel a bit clunky. Thankfully I only plan to release on PC so I'm not super stressed about fine grained control over assets, otherwise it could be quite the headache
The fact that if you want to use addressables 100% that you need a scene to then load another scene is crazy.
It's half baked and not properly integrated into the engine core
TBH all the new packages feel like that to some degree. The project's pretty dots/ECS based, and whilst that actually works pretty well and is a great package, you can still feel the friction between it and the old interfaces
Can't entirely blame them, it would be a ballsy and costly move to gut things to adapt to the new requirements
are those all individual bundle files per tile? surely that's a huge amount of IO and memory overhead for a 1kb asset
They didnt clarify but 40K file open/closes could be an issue
Nah, there was a single file. They're all in the same addressables group.
That said are there circumstances under which a single group would splinter into many bundles like that? And would they end up in the same file on disk? I could have been misreading the situation
(All I ever did was mark the root folder as addressable and give it a name, never tweaked much beyond that)
it's an option in the group's schema settings, if you aren't sure best double check what's in your output folder because 40,000 bundles would be bad lol
Looks like they were set to pack together so unfortunately can't isolate it to that one.
Then its either decompression or some dumb thing
Interesting thread on the matter: https://discussions.unity.com/t/addressables-extremely-slow-load-time/827561/24
One suggestion is that CRC might be the cause
(Going to test it and see)
Alright so the outcome is better but not optimal:
- With uncompressed, pack together, CRC disabled, and use unity webrequest, it takes 15 seconds from launching the exe to seeing the window, and peaks at 2gb memory usage.
- By contrast Resources.Load takes 3-5 seconds and peaks around 600mb.
- The original addressables launch time without those settings was minutes and peaking at 5gb.
(P.S. At the moment I'm immediately loading the assets on launch)
As a fun kicker using addressables roughly doubles the build time as well, from 3ish minutes to 6ish.
I'm trying to do content update builds in order to reduce iteration time, but the content update build takes roughly the same time as the full build. making a change in a prefab that is part of a group for example, does not show up in the Content Update tool, using this piece of code ``` string contentStatePath = Path.GetFullPath($"Assets/AddressableAssetsData/{EditorUserBuildSettings.activeBuildTarget}/addressables_content_state.bin");
AddressablesPlayerBuildResult result = ContentUpdateScript.BuildContentUpdate(addressableAssetSettings, contentStatePath);
if (!result.Error.IsNullOrEmpty())
{
Debug.LogError($"Failed to update Addressable Assets because {result.Error}");
}
foreach (var t in result.AssetBundleBuildResults)
{
Debug.Log($"Successfully made bundle {t.InternalBundleName} at {t.FilePath}");
}``` I'm calling the content update, the output of the build result is essentially every bundle in the project.
What if you try giving all the assets the same label and then calling load by label?
Hi everyone, I'm using some code to draw a preview of a gameobject ion the inspector using DrawStaticPreview, to do so I need to breifly load in the object using its addressables key (this is what is serialised in my scriptable object to use at runtime).
My problem is that as I type the key i get errors as Addressables.LoadAssetAsync does not contain an object for the given partial part of the address key. This is to be expected, but I was wondering, is their a way to stop it throwing errors. Like a TryGet or a contains function within Addressables. That can be checked before loading the asset?
I could just use a try catch, but I would rather do this correctly then brute force it and just ignore the error.
AsyncOperationHandle<GameObject> operationHandle = Addressables.LoadAssetAsync<GameObject>(_addressablesKeyTextField.value);
if (operationHandle.WaitForCompletion() is not { } gameObject) return;
RegeneratePrefabPreview(gameObject, width, height); // This calls RenderStaticPreview
operationHandle.Release();
This is the code I am using. The error occurs on the Addressables.LoadAssetAsync line
I think I found a solution, by using LoadResourceLocationsAsync, I'll give this a go and then update everyone if it works :)
https://discussions.unity.com/t/can-i-ask-addressables-if-a-specified-key-addressable-name-is-valid/719356/6
string key = _addressablesKeyTextField.value;
AsyncOperationHandle<IList<IResourceLocation>> resourceLocationOperationHandle= Addressables.LoadResourceLocationsAsync(key);
if (resourceLocationOperationHandle.WaitForCompletion().Count > 0)
{
AsyncOperationHandle<GameObject> operationHandle = Addressables.LoadAssetAsync<GameObject>(key);
if (operationHandle.WaitForCompletion() is not { } gameObject) return;
RenderStaticPreview(gameObject, width, height); // This calls RenderStaticPreview
operationHandle.Release();
}
else
{
ClearStaticPreview();
}
This seems to work!
Hello, im using asset bundles in my pc,xbox and ps builds. The problem occurs on xbox because of the file from streaming assets folder is not included in the final build what is weird considering the fact that its meta file is there. This happenes only on xbox tho
are you using the default built-in paths in your profile?
Yeah
Do the bundles exist in Library\com.unity.addressables\aa\ + your platform after the build is complete?
Is it only the package that does not contains them or the loose as well ?
so there was an asset called map and map.maifest in streaming assets
and this asset would only load on ps5,PC but on xbox it wasnt even there
like it was somehow erased during the build proces
soe we changed the name to map1 and then to our suprise it worked
but when we changed it back to map it was again gone
basically every oother name that isnt "map" works fine
no idea why this happenes only on xbox tho
we are using the og asset bundles and unity 2022.3.52f1
its like literally during copying the files into the build package, it was somehow removed along the way
Hello everyone, I like to ask regarding addressable asset with unity cloud. I try to add skyboxes on level 1 scene but after I created release, I can't open my scene. Does anyone know how to resolve it? Do I have to delete level 1 scene bundle from bucket?
Share the error you get when you try to load the scene
I think I know why I can't update my scene. It's because prevent update toggle is still on. I can't toggle it off. Do you know why it happen?
I got 2 addressable scene. then I want to update first scene by adding skyboxes. after I change the skyboxes then I want to Update a previoud build without rebuild the app. Then upload the new server data to unity cloud content delivery. after I try open scene that I've updated with previous build I got error "Chain Operation Failed because dependent operation failed". I try it before on editor and the update it's changes. I already did toggle off the prevent update on Addressable Asset group.
I appreciate any help
Addressable props have broken light/shader/colors/material/AO
This value is not missing though: Shader shader = mr.sharedMaterial.shader;
If it was created at runtime, perhaps it looks different as its not using baked light?
Is this screenshot from the editor or a build?
Ah yeah i forgot to mention this happens only in build
Editor and build respectively
I dont use baked lights
Everything is spawned runtime
Do you use reflection probes in this scene? Do these other objects appear "lit" even with no lights close?
you can try using the frame debugger and if its URP the urp debugging shaders
I do not, and yes
Usually its due to reflection probes not being used so they reflect a bright sky but other objects would do the same in this case 🤔
if your scene sky is black or a dark colour then this probably is not it. try to investigate with the 2 tools i mentioned
It seems to be my camera script. After i disabled it, the editor and build look the same
Oh i change ambient light in that script
Well it wasnt ambient light it was the fog. Fog influences prefab-spawned props, but it doesnt influence addressable-spawned props, in build
Ah yea that sucks but a good reason why 99% of stuff should then be addressable
This would be solved if asset bundle -> in proj referencing worked but somehow no
Hey y'all!
I'm currently in a situation where I would like to, at runtime, iterate over every environmental texture I use in my project, to change a setting in it.
Are there counter-indications to using addressables for this?
I'd have an asset group containing all environmental textures
If you load them all in and keep them loaded with the modified data it should be fine? Try to load them all in 1 operation if possible vs many separate ones.
So I'd be loading them all when I start the game once and then never unload them? Is this not going to have a performance impact?
I don't think a change to their settings would persist if unloaded. And the cost would be memory usage on the gpu (cpu side too if read +write enabled)
Addressables is better than normal unity and will unload assets when released with 0 users remaining
Thank you very much for the info!
hi hi, i'm currently looking into porting a project to WebGL that is already on standalone platforms. i know there's no way to do WaitForLoad()s on webgl right now, but im looking for workarounds / how to integrate this without having a metric ton of work rewriting asset loading.
so far the easiest (and only) solution i've found is to rewrite loading functions to use coroutines instead of regular function calls. is that the only way to do this?
and also, will that actually fix the issue or would it cause other problems / still complain
looks like trying to load one asset bundle is also calling something for every asset bundle in our addressables build... is there a way to avoid that?
The answer is async or coroutines and should have been how it was done from the start.
nkay well thanks but you could lose the judgement since this is an extremely old project that predates addressables lol
Yea at first it requires a large rework to go to async everywhere but its a good transition to make. Check out UniTask or Awaitable
getting slightly conflicting things, does this mean awaitable doesn't work on webgl with addressables?
seems like awaitable is a fairly new API so i'm not entirely sure if it's just documentation hasn't been updated well or if it actually just wont work
i haven't used webGL in a while but tasks work fine so there's no reason Awaitable should have a problem, i think this is just an implementation detail of addressables
Unitask may work as it has its own extensions for async operations
yeah ive seen that awaitable should work fine, its just that the system threaded tasks dont, and im HOPING they let you get it anyways but it's kinda hard to tell... just trying to learn about awaitables now since it's a new concept for me
you should be able to write an equivalent extension method which just waits until the handle completes using Awaitable.NextFrameAsync afaik
that's true
tasks do work fine in webGL, it's just that some APIs touch threading stuff which doesn't work and it's hard to tell which ones that affects sometimes, but once you know it's totally safe
Unity has its own custom scheduler for tasks anyway so it should work but trying to use other threads won't
it's stuff like you can use Task.Yield fine but Task.Delay will break, Awaitables is designed for Unity so it's clearer which ones actually involve separate threads
Why a normal task was added for use was dumb. Classic unity moment taking too long to do it properly
This is why UniTask exists and is better
im looking to be more futureproof, seems like awaitable is probably the better choice here if it works for me, right? since that's the supported solution now
obviously hard to predict the future, just asking based on my initial judgement
Tbh UniTask has more features and implements more features that Task provides such as UniTask.WhenAll()
maybe i dont even need either? i assumed i needed some wrapper but if it lets me get the underlying task, and i can await it, that should just work, i think
no you want to avoid .net Tasks and use the other solutions as they prevent garbage creation as much as possible
public async UniTask LoadThing()
{
//UniTask extension lets us await directly!
Sprite s = await Addressables.LoadAssetAsync<Sprite>("my[sprite]");
}
the take away is Task bad, Awaitable better and UniTask best (im my opinion)
you can implement it yourself trivially by using the Completed callback and a TaskCompletionSource or AwaitableCompletionSource
or wait in a loop until it's done
the Task property doesn't really do anything that special
its probably that the task completes using another thread or some shit
anyway i said enough just dont use .net Tasks
it might do but you don't care about that for webgl haha
see i was thinking about this, but assumed that it just would block the thread alltogether
though im curious now if that woujld work lol
you await Awaitable.NextFrameAsync() within the loop
oh i thought you were talking about without awaitable
yeah ill probably just do that
it's just gonna be a pain in the ass to propogate async/await up through this giant fucking call stack
yeah, iirc you can wait for some types of operations in a blocking fashion when they run on background threads, but in webgl that's not possible so it'll have to all be async
yeah which is tough because none of this code was written with that in mind
so it's all gonna be fake async anyways because the code is all just gonna await for it anyways
if you're awaiting it, it's not fake 😛
if you need to avoid making everything async, adding C# events can be a useful way to deal with async stuff from non-async code, letting you still write the complicated async bits as async then hook into them from outside
The past 5+ projects ive worked on all use unitask with addressables and with our major systems converted its much nicer
its worth taking the step to integrate async more where it helps
And you can use .ContinueWith() to execute a delegate when a Task completes which means you dont need to await it:
e.g.
cs DoAsyncThing().ContinueWith(() => Debug.Log("Done!"));
yeah th emain issue is that the entire crux of this system is that everything boils down to a LoadAsset(...) which returns the asset. and internally it was doing WaitForCompletion, which works fine on non-webgl builds
so i either need to (a) turn the entire call stack async & await it or (b) rewrite the entire thing to use callbacks / delegates / events instead
because what i'm doing is so simple (in terms of async needs) i'll probably just do (A) with awaitables
yea you should just convert things to be async or use the async operation .Completed event to then do stuff but tbh that will be more pain than async.
Either of these solutions work as they execute code in the future vs you making the main thread wait for the load to complete.
@honest halo does UniTask let you change from doing await task to yield return task in a doable way? it would SEVERELY reduce the number of changes i need to make, because i'm going to get to a coroutine far before i get to a unity event function
UniTask lets you await a coroutine if that helps?
i looked it up and it seems like theres a UniTask.ToCoroutine() which would be what i need
oh yea and that, so it helps you go both ways
cause instead of needing to refactor until i reach an event function i can go until i get to a coroutine
Yea makes sense. UniTask is just better (and existed before awaitable)
alright, i've now found out that since i'm resolving to coroutines, i can instead just do
while (!task.IsComplete)
yield return null;
because that's what i actually need to avoid a huge rewrite, and avoids libraries alltogether (i think)
yes that works, async awaiting will be technically better as we dont have to have something checking state every Update()
at this point do whatever 😆
yeah it would be better, the issue is that in order to do that i would need to rewrite our whole internal system for running stuff, since i would need to convert all of that to async as well until it propogates to a unity function
took awhlie but now i finally know what the "whatever" is going to be 😂
anyone able to get addressables to work on 6.0.45f? tried for days but it wont build them out for me
i always get this
Is this "use existing build"? You can change the group to keep it's name to make finding what this is easier
new build->default build script
missed a pretty important deadline because i cant build lol.
I think before I've had builds fail due to duplicate assets in groups so check them all
Does that error have any more info btw?
nope
i do have aosme shader errors when i build but if i try again they go away, and the game built out fine a few versions of unity ago
which version of unity do u use @honest halo ? have u tried 6.0.45?
Where I work we are still on 2022 so no. Is this the latest 6 patch version?
looks like .47 is available now
yeh 2022 was stable and awesome
ill upgrade tonight but i guess it wont help, might end up going back a few versions
Hi, I have a small/big issue, when I move item/UI element over a empty space (there is no panel / UI element under it) it will leave afterimage like on the ss. I am working in Unity 6.0
wow my bundles are buidling finally, i just ticked and unticked tons of stuff for days lol
put it in a panel? 🙂
argh i still get errors in the build
Unable to open archive file: f0f4e673107fe35459efc8037aaed4ac/50a60aa227fdcf1ac7cba35abfb60fda.bundle
RemoteProviderException : Invalid path in AssetBundleProvider: 'f0f4e673107fe35459efc8037aaed4ac\50a60aa227fdcf1ac7cba35abfb60fda.bundle'.
damn, addressables really wrecking my life
invalid path in textDataProvider, then points to a json path that doesnt exist
got them built, no idea how, just random clicking 🙂
If you are using source control can you check the group setting changes?
oh yeh, im not though
never got it to work with unity properly (and without huge cost)
i could diff them tho, i do zip every night
would be nice to host it in source control, but never works lol
yea its time to learn, you just need a .gitignore for unity (and maybe enable git lfs if you have files over 100MB)
private git repos with github are free but lfs space is not fully free
yeh my projects are always huge...
yea mine too but they are all on github
i already pay for github but i think its only £10/month
oh then you should get uploadin
https://github.com/github/gitignore/blob/main/Unity.gitignore
haha
maybe i will try again but i can be sure it wont work for whatever reason
thanks for the file
An average old work unity project
10GB of this is the Library folder (which we do not commit and the git ignore will already exclude)
hahai consider that a very small proj 🙂
but yeh its mostly waste in my pprojs, thousand sof assets that arent neccessarily in use
thats just 3 current projects sitting on my ssd 🙂
but yeh without lib folder much smaller, ill maybe try commit to github again,
think when u get too large u need to pay more
Good lord, i work on mobile games so their size is naturally smaller.
if you are already paying or have a company acc then it shouldn't be an issue
nice, yeh i used to make mobile games for long time, long before unity even 🙂
we had to make them under 64k lolz
right now im trying pc/console
tho this build is dog slow, trying to profile it, runs faste rin editor
will github desktop be ok or do i need whatever unity uses these days?
hmm its slow in the editor actually, since the upgrade maybe
nice all builds now and runs faster, after degrading, thank god
its supposedly better than using resources for many reasons you can read up on, though it is quite a nightmare imho.. BUT things like consoles wont let u publish without actually using it. i think the main rationale is that its far easier to patch game content this way, rather than resources where u need to replace the entire thing every time... so it makes patches for games smaller.. and i think its faster/easier to load things from wherever..
and delivery over the air for webgl is nice.. game can run and wait for the bundles to come down etc
tho i get confused between addressables and bundles 😉
Addressables uses asset bundles by default for holding assets. It means then it has the fatal flaw of not being able to reference assets in the build.
And platforms like steam already handle diff patching on large assets well but the tech on consoles has never caught up somehow
e.g. fo76 update size differences
I presume it does help having many asset bundles and better control of how much assets are split up (and as you say, patching assets any time)
I heard that it has uses for dlc
How does that work
lol we just explained all that, time for u to google..
Is there a way to enable the CustomPropertyDrawer in the BundleNamingStyle script that comes with the Addressable system package?
In my project's BundledAssetGroupSchema option for "Bundle Naming", my options are:
- Append Hash
- No Hash
- Only Hash
- File Name Hash
However in the Framework that I'm using as a reference for my project, despite being on the same Unity version and Addressables Package version as my project - they have these options instead:
- Filename
- Append Hash to Filename
- Use Hash of Asset Bundle
- Use Hash of Filename
I'm aware that they're technically corresponding to the same enum value, but I like the other one better since it provides more clarity
where is Send Profiler Events serialized? Or is this something that is only set in code? Where should we set it to ensure it's profiler events wont be sent in a build
Hey everyone,
I have a scene that includes a terrain, and I've marked this scene as addressable. However, when I run the APK, the terrain shader doesn't appear (it's missing or turns pink).
Does anyone know why this is happening?
Add the shader and/or material to an addressable group too. If it doesn't know a shader is needed it is stripped.
older unity versions have a bug where 100% of shaders are stripped (even if used)
I have tried but Terrian looks transparent.
Shader variants can also be stripped when it doesn't know they are needed but not sure if that is the problem here.
Do you get any errors in the build relating to terrain?
No error everything works fine, even Terrian looks well in editors only issue occurring in mobile.
swap to your pc platform (e.g. windows), build bundles and do "Use existing build" and then play and see what happens in editor
then you can inspect and see what its doing
Yes I am testing with the same settings and working with the editor.
I did some testing and find out its happening due to enabling draw instance in terrain setting.
strange that gpu instancing did this but id presume it was some shader variant being stripped
@honest halo haha yeh so tried git again, no where near usable to store my project as usual, not quite sure why people advise using it
perhaps something like svn will work better if you have loads of large assets?
it just consumed 150 gig and filled the drive
ill stick to zipping and drop boxing every night
to be fair, git lfs exists for this reason as at its core its made for text assets
svn, plastic scm (bought by unity to become unity svn)
Git is well respected and well used for source code management
like I JUST said its not good for tracking many big binary files hence lfs existing as an extension
yeh git kind of works for normal code projs for sure
i been in this since before CVS
at rockstar we used "sourcesafe" but i dont see it mentioned anymore
dc we used cvs was hell
git never been good for anything but text and small projs
I used svn with large unreal projects so try that or go do some googling yourself
yeh my back ups are horribly clunky, but zero hassle
every single day im faced with this git argument
and after trying for like 20 yrs, never works
Ha okay make a duplicate of everything everyday instead of a real solution 🔫
t'was a joke
i know 😉
gits fine for code..
and thats it
wiped, that experiment wont take place again for another decade. maybe i can use a combo of ftp for files and git for code.
i will be retired before theres a working solution lol.
zip+dropbox, still good..
Hello, I have a question regarding addressables and Ui Toolkit. When I have data binding set in UI Builder to SOs that are addressable do I need to set binding to them again via code after I load them through code?
Answer that I found is: Yes.
Any reason why I might be able to load addressables by label in editor, but not in builds?
In this case we're talking local path addressables
are some groups not included in builds? out of data catalog?
Are included in builds. What do you mean by out of data catalog?
sorry, out of date 😆
ah, lol. This test is being run with a new build (and addressables build). I have a remote catalog floating around (you helped me a lot with that one, I'm sure you recall) but this specifically is being done with a local catalog
shouldn't be possible for a local group to be out of date, right?
if remote catalog is disabled then im not sure how. this data is stored in there. asset bundles just have the assets in them
interesting
Have a theory that it's about how the label I'm trying to load from is getting passed to the loader
Hopefully I shall know for sure soon
update: Looks like it actually does work, just incredibly slowly. I tried a shortened label with just ten entries (rather than the true 10,000 or so) and got that to load after a minute or so. Naturally that isn't going to scale so hot though.
Presently trying loading from a list rather than a label in case that's faster
The extreme slowness seems to be unique to playstation builds
hi
I have a panel in Unity that I load and display using Addressables. Everything displays correctly in the Unity Editor, but when I build for Android, the Images appear completely black and the texts either turn pink or black.
My project uses URP in Unity 6.0.
Can someone explain how bundles work. Lets say I’m loading a ui prefab with a AssetReference. If all the ui is in a single bundle would everything be downloaded in order to Instantiate the single prefab ? Right now for example my UI group is set to pack separately but what I am trying to do is optimise the catalog size since that is a big chunk of our initial load time
Also if we load assets by asset reference I obviously do not need labels in catalog but what about include addresses ?
If you pack your UI into a single bundle and have the Asset Load Mode set to "All Packed Assets And Dependencies", it would load every asset in the pack and their dependencies.
If not, it will only load the given asset and their dependencies. However, you will not be able to release any asset loaded as long as one asset remained "used" in the bundle.
For download, I have no idea as I never used addressable in such context.
Pretty sure that when they are in the same bundle you have to download the whole bundle
I’m mainly looking into decreasing the catalog size
Just for information, I had 3k bundles which resulted in a considerable catalog size. Now I have 1.5K, it is still kinda bloated but it is workable for the Switch.
The first things I did was bundle scriptable object together. They were bundled seperatly for some reason.
i have noticed scenes always get their own bundle
i agree Gaz git is not good version control, was partial to the pay content unity gave 8+ yrs ago.
i nearly wrote my own version control about 6yrs ago.
Hi I'm using the latest version of addressables. After loading the addressable into memory and storing the assetReference and the assetReferenceHandle. I attempt to spawn the asset using the assetReferenceHandle from another script. The thing is the assetReferenceHandle.IsValid() return false from that script.
The script that does the actual loading of the asset returns IsValid() true.
I'm definitely references the same assetReferenceHandle, but I've no clue why referencing it from another script returns isValid() False
I'm storing the AssetReferenceHandle in a scriptableobject.
Both scripts access / load the AssetReferenceHandle from that scriptbleobject
Do you mean the AsyncOperationHandle? this is for loading the asset. You should just pass around the actual loaded asset ref afterwards.
And they cannot be the same handle as its a struct
This is what I'm doing, I'm storing the handles and reference in a scriptableobject
no the ACTUAL asset
so GameObject in this case
If you want to instantate it from AssetReference then do this, otherwise get the gameobject and instantate from this
1 moment while i show you my 2 other scripts
Script A: LevelAssetsManager (This loads the asset into the scriptableobject above)
Script B: Weapon (This access that same scriptableobject above) and attempts to spawn the asset (bullet) that was loaded previously in Script A
no idea if this is your problem but should that not be tasks.Add(bulletSpawnableData.AddSpawnableToNetworkManager())?
The issue is Script A can access that asset Reference handle while Script B when it tries to access it, it says the handle is not loaded
Use UniTask or Awaitable instead of task btw 👞
and if you use unitask you can await the load and ignore the async operation
that's probably not related to the problem so this isn't very helpful lol
oh dear
Oh pardon that stray code, I was directly testing, loading that bullet by calling it directly instead of the list.
Both ways doesn't work though
if you want to test that, seems like it'd still need to be await bulletSpawnableData.AddSpawnableToNetworkManager() instead
i'm just pointing that out because not waiting for the handle to complete seems like it could be related so best to rule that out by either fixing it or removing it!
Yup just tested it with await, still not working. Btw the bullet is not spawned by the weapon on runtime, it's only when the player clicks the mouse button which is 5 seconds after that code executes
Oh AND BTW
This issue only occurs in my Build version of the game
In Editor, both Script A and Script B can access the handle
So I'm really confused as to why the Windows Build is giving issue
AND 1 more thing
As shown in the above sample script, it is loading muiltiple assetReference in that list. NOT just the bullet. BUT only thaat bullet assetReference returns invalid from the weapon script.
The rest of the assets like the Player Prefab and Level Prefab assetReference works fine and they spawn into the game no issues in the Windows Build
are you sure both scripts are looking at the same instance of the SpawnableData?
I'm not sure why it is only that Bullet Prefab that is having the issue
in a build, if you have duplicates in your addressables setup, you might get duplicates from different bundles
you might be able to see that in editor if you turn on the Use Existing Bundles setting
HMMM but the issue is the error only occurs in the windows build
it works on other platforms?
well, in editor the default is to fake all the addressables loading and load straight from the editor asset database, so it doesn't behave the same
so it's probably worth testing with the existing bundles option
Great point, alright let me search that existing bundles up
it's a dropdown in the groups window if you haven't used it before
it does require you to have run a build previously (files must still be in the library folder iirc)
Thanks found it
Ok now the error is occurring in editor as well! I'm not sure why it is doing that since I'm referencing the bullet Scriptableobject.
The weapon script B is accessing the Bullet ScriptableObject from this Database scriptableobject
And than script A is referencing the Bullet scriptableobject from this scriptableobject Level 1 Asset
Both are pointing towards the same Bullet Scriptableobject which contains the assetReferenceHandle
are the level asset and the database asset in the same bundle?
Oh could that be the issue let me check
oh right no, level 1 isn't even addressable 😄 so that's probably it
you have a copy of "Bullet" baked into the base game, and one in the bundle that the database asset is in
so two different instances at runtime
Thanks for pointing that out! Can I check if I mark Level 1 as an addressable assets but have dragged and drop into a gameobject in the scene, do I still need to load it into memory or does unity treats it as a non addressable?
scenes in the build list are baked into the game along with everything they have a hard reference to, so it sounds like you'd still get a duplicate that way, you'd need to make the reference to Level 1 an AssetReference too
there should be an analyze rule you can run in the Addressables anaylze window to point out any cases of this
(my project is a few versions of addressables back and they keep changing stuff so idk if it's still there lol)
Yes seems like if I go the route i'm proposing it'll create duplicates/mess up this hold thing. I'll modify my code to not access the level 1 scriptableobject directly in this case. Gotta get this bullet asset handle issue resolved!
I see I'll try looking for that window. Yes after updating addressables to the latest version there were quite a few changes
Alright issue has been resolved (bullets are spawning in both windows build and editor) and it was due to the duplicates indeed! Can't thank you enough for the tips (i've been stucked for hours trying to troubleshoot this).
yay 😄 duplicate assets are a big hazard with addressables, it's nearly invisible until it goes wrong
just something extra you have to be thinking about all the time unfortunately...
Due to the flaws of asset bundles you are basically forced to move everything to addressables
e.g. initial scene loads into an addressable scene as soon as possible and then addressables only!
Noted on that! Now everything including the levelassets are in that one Database scriptableobject which is the main addressable. From now on I'll just populate this database scriptableobject to avoid running into that issue
Interesting, my scenes are currently not addressable (I'm only using 1 scene at the moment). Lobby UI will simply just spawn the level and other prefabs in that same scene and the game commence in that 1 scene. After the game ends, I'll simply unload all the level assets out of memory
its just an example, projects I work on basically only use addressable scenes and assets
If you know when you can cause duplication then you can avoid it but its easy to do accidently
If i have more than 1 scene I'll definitely look into making those addressables. But then in this case do you include the scene in the build "scene list" if they are addressables?
I personally think assetbundles are flawed that there is no way for them to reference into the build (but they can depend on other bundles?)
Btw I'm actually only using just 1 bundle for the entire game at the moment. Am I right to assume as long as I don't load the specific asset, it won't be loaded into memory?
Asset Bundles are only used to control the game storage size correct?
not to control the memory consumption of each level
asset bundles are where the assets are stored, and they should support partial loading to not require opening the whole thing 🤔
Ofc splitting up groups and/or bundles helps with downloads
iirc it depends on your compression settings, where compressed bundles are fully decompressed into memory and stay there until you unload them: https://docs.unity3d.com/ScriptReference/AssetBundle.LoadFromFile.html
presumably meaning uncompressed ones can be loaded from disk as needed
Oh so it's saying the assetbundles are stored on the disk and has to be loaded in. Does this mean that technically I'm not using addressable to it's full potential to reduce memory? Since I'm directly loading the addressable from that 1 bundle and not unloading/loading the bundle at all during runtime
This means that 1 assetbundle which I'm using and all the gameobjects in that assetbundle is always on the device memory
yeah potentially, although of course the compressed form of those assets in the bundle is still smaller than having them fully loaded as objects
Actually when I did some profiling, using Addressable alone (without loading/unloading the bundles) already reduced memory quite abit
it depends a lot on what kind of assets you've got, if you have lots of large textures or audio it might be worth putting those in bundles that can be unloaded as needed
I see! So in a way it's still better than not using addressables, but still I guess I should implement that loading/unloading of assetbundles otherwise it seems quite wasteful to have that assetbundle seating in memory even when i'm not using it
the tradeoff is loading time because putting everything in separate bundles means lots of disk operations unloading and loading stuff
but using addressables does give you the choice at least 😄
as long as you release assets you loaded then addressables will unload stuff for you
Oh yes. Having a player load bundles and load the addressables each time he attempts to join a room can cause increased loading time (I might need to implement a loading screen)
Yup I'm releasing the assets
Do you mean if I release all assets from a specific bundle, addressables will automatically unload the bundle as well?
yes
Its better than normal as assets like textures will be unloaded sooner vs needing to call Resources.UnloadUnused
I see, thanks for the info
Question: what is the behaviour of "pack together by label" for addressables that dont have labels
Answer: all in the same bundle
last post is saying its fixed soooo
yeah, the op is me XD
How do you guys manage the addressables in your project ?
I'm new to this (and gamedev in general) so i searched around and whipped up this manager
can someone please give me a quick code review or just tell me if this direction is horrible from the start ?
Tysm

Does LoadContentCatalogAsync use gzip compression for downloading the catalog?
!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/, https://scriptbin.xyz/
📃 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.
A tool for sharing your source code with the world!
I think making an "addressables manager" is a waste and will cause more problems down the line. If an asset needs to be loaded and used a lot then yes load and keep it somewhere, otherwise you dont want to "cache" an asset as we want to release stuff later and make use of auto unloading
If i have something that uses addressable assets, it usually handles loading + releasing per instance of as a whole depending on the situation (e.g. ui element view vs world/level manager)
I use this https://github.com/Haruma-K/Addler
Binding to a game object is a good idea actually, should be added to addressables
So I'm getting headaches with the player now that I'm using addressables. Everything works fine in the editor but the player build is getting hung on WaitForCompletion, which I call from Start() - I guess I should just not do that? But I don't want to have my scene loading be async, various code needing to wait for addressables to load before doing anything -- so now I'm about to make GameObject with a few public objects that I'll connect in the edtior, and then Unity will load them with the scene. And this won't work at all because at some point I want to load things by filename. I'm thinking I'll just go back to using Resources even though that's supposedly outdated - but at least it worked
And I also looked at having a loading scene load in the addressable assets before the main scene, but I put those in static fields and were apparently set to null when a new scene loaded, even with DontDestroyOnLoad. So I'm confused if addressables is really supposed to be used for things all that widely
WaitForCompletion() stalls till its done so if it needs to download data your game will freeze for the duration. What platform is this btw? On web you have to await the result/use a coroutine/use the completed event.
So what is the real difference between AssetReference.LoadAsset... and AssetReference.Instantiate.... The docs don't really make it clear. The only difference I can think of is that LoadAsset loads it into memory but doesn't create, like in the case of ScriptableObjects?
yeah, imagine for example loading a bullet prefab ahead of time so you can instantiate it immediately later rather than using the async instantiate method
and of course LoadAsset is needed for anything that isn't a prefab as you said
Alright I think I get it, thanks. Trial and error ahead.
You can still load the prefab via addressables and Instantiate() as normal. However do remember you need to use Addressables.ReleaseInstance() on addressable instantiated things instead of Object.Destroy().
Is it also an acceptable model to use Addressables with regards to certain aspects of the game? Like for instance, non UI stuff would just be normal assets where more game specific prefabs likes buildings, characters, etc would be addressables? Or is it intended to be a project-wholistic thing?
I have a pretty good UI system right now and using addressables would make it not so feasable.
its fine but you have to be careful about asset duplication then as if its used in both addressable and non addressable things it will exist twice
Its why projects I work on are 100% addressable, intro scene loads into an addressable scene very quickly
well I would have something that is like an AssetManager that would be count references and release on scene offlloading and stuff
addressables does this for you when you release assets (e.g. unload a texture)
oh I see what you are saying, addressable will create an instance of a non-addressable when used by an addressable.
So keeping to ScriptableObjects, if I LoadAsset on one, and that instance is used by several other game objects, would releasing the asset once cause null references in the game objects that had one?
I think I'm also realizing I will have to create an entry scene that loads the addressable entry scene...yeesh, good thing im early in the project lol
No a managed object wont just vanish but a texture it references can be unloaded (meaning the actual texture data will go away, but the Texture managed object still exists)
This issue is a lot clearer when the texture or asset is used and you can see visually that it was unloaded (e.g. turns white/pink)
This explains what happens with managed objects that wrap native data (e.g. audio/texture): https://docs.unity3d.com/Packages/com.unity.memoryprofiler@1.1/manual/managed-shell-objects.html
So in reality I shouldn't have to worry about AssetReferences if everything is an addressable ya?
AssetReference is just a nicer way to load an addressable asset without giving the address so its no different
It's only when a non addressable needs to manage loading/creating of an addressable
I dont want to confuse you. If you load an addressable asset, release only when its not used/needed anymore so the asset + dependencies dont unload at a bad time.
The profiler can show asset usage which can be useful to find times you forget to release something
And that's where I think I am confused. Everything in addressable space can still hold typical serializable references to other addressable without having to manage anything. It's when you get down to stuff like bullets or spawning that you need to manage using asset references. Otherwise, UI or scriptable object serializable references can be used the same?
If I have an addressable prefab but in the prefab my script has public Texture2D myTex; then this is just treated as a dependency. This gets loaded in memory when my addressable prefab is loaded. AssetReference is not a hard dependency as is basically the same as doing LoadAssetAsync()
hey guys, does anyone have any documentations or example codes or projects for unity google play asset delivery on demand ? i am already using install time delivery type but i want to change some of the delivery types of certain things to on demand so the initial download size is lower. i probably should have a button and when they press it it should bring up a loading bar that shows the download go up, is it something like this ? m_SceneHandle = Addressables.DownloadDependenciesAsync("Assets/Scenes/exampleScene"); and i link the m_SceneHandle with a slider that shows the progress and when its done i load it using : Addressables.LoadSceneAsync("Assets/Scenes/exampleScene"); ?
hey guys, i have a question about on demand play asset delivery, i am trying to use it but when i install the application from the playstore it just starts downloading the on deman assets immediatly and whenever i try to check if its downloaded or not even if i cancel the download of the on deman assets it tells me that its downloaded, i am using this method to check if its downloaded or not: long downloadSize = await Addressables.GetDownloadSizeAsync("Example").Task; and it always returns 0, what should i do ?
Is it normal to just...not use labels at all?
I haven't found a need to bulk load assets yet
Since most of my code up to now only deal with singular asset
Can I just group the assets in a smart way and load them by address for the full project?
Chatgpt says yes but I don't trust it
(I'm using Haruma K's Addler)
I can give an example of when i used tags. I gave assets used by a certain level a tag so I could prompt the download size required and then also pre download them all at once. Instead of configuring a list of addresses using a configued tag is simpler.
Did you preload the whole label/tag into memory and then load the needed singular assets for different pieces of code with subsequent loads?
How do the subsequent loads work then? I find it difficult to find a singular asset with just labels
I'm new, I'm genuinely asking 
Do you load with addresses or find it by using IResourceLocation matching
It was only to ask to download with an accurate size and to then trigger a download ahead of time. After this assets were loaded normally.
is that just missing the file extension?
we need to specify even the extension ?
i set the type as gameobject when searching already
i mean you can set whatever you like as the addressable key, it's just a string, the default you're using there includes the extension though
you can see it in the screenshot
so if i dont mark them individually i must include the extension ?
the group name is also included in the address right ?
no, addresses are per asset only
you're marking the folder right now, which means they only have automatic addresses
if you don't want to type in specific addresses for everything, consider using AssetReference properties instead of loading by string keys
then it's just referenced by GUID and you don't need to care about the key
AssetReference, from my very limited pool of knowledge, is just like a serializefield?
or is there any other way to use it ?
yes, make a field of that type and in the inspector it becomes an object picker for addressable assets
internally it just stores the GUID
Assets in a folder thats addressable annoyingly get the file extension in their address. You do need to include it as that is its address
ofc you can override this and give it any address you want
the address is this line right ?
ALL of that is yes
thanks !
its address is Scene_prologue/Base/Back.prefab
the group name doesnt matter at all right ?
nope does nothing
unless my packing strat uses group ?
still no. The address is not affected by the group (unless you disable including addresses in the group)
no i mean group only matters when you use the pack by group?
the packing mode affects bundle filenames, but one of the big features of addressables is game code generally doesn't need to care about the bundle files, it handles that for you
Ah well yes its group will specify what asset bundle it goes in and how its loaded (local or remote)
Yea addressables handles finding and loading the file for you which is what makes it soo great
you can simplify the folder address so it makes the paths of stuff inside shorter too
R click -> Simplify address
or change to whatever you want
yeah but the simplified version eats my CGs dir
should i even categorize them by file type like that ?
dunno its up to you
Games I work on usually has configuration for things and i add addresses for stuff in that (so it requires no special format)
Is there a way to have it so that the hashes added to the filenames of the outputted bundles stay consistent between two different machines that build?
hey guys, does anyone have any example codes or documentation for addressables for android google play asset delivery on demand delivery mode ? or if anyone have worked with it before i need some help
I forget where the hash comes from but its meant to make the names unique so you can upload new bundles to the same folder.
Otherwise you should separate them a custom way (e.g. Application.version)
I see, do addressables for production always need to be built on the same machine?
Remote no but you may need to disable CRC checks for local ones as the hash will change in catalogues built elsewhere sometimes
How do I explain to addressables to load my custom ResourceProvider ?
It’s from the schema nevermind
How do I address more than one prefab with a tag or layer? I have approximately 150 prefabs and I need to be able to instantiate enemies inside these 150 randomly (I'm not gonna instantiate all of them at the same time)
Here is my current code
I have given "enemy" tag to all of my prefabs
However the first Debug gives me 0 as an output
Set the merge mode to Union and check the label is correct. Im confused why you put the locations into a list of object (probably going to make things worse)
It should give a List of IResourceLocation and these can be used to load the assets later
lastly, making a list copy is wasteful and not needed
Ok I’m failing hard on this. I want to encrypt and decrypt the default local group bundle. It’s set to pack together so there is only one bundle to handle. The encryption/decryption works fine in my custom provider that extends ResourceProviderBasr but when I complete the ProvideHandle with the asset bundle I got from AssetBundle.LoadFromMemeryAsync it says it can not load the dependant bundle for the Cube.prefab that’s in the default local group. The group itself has two items a cube prefab and a material for it. It also pulls in some urp shaders.
Thanks! I really appreciate it!
hi
where can I find the addressables build report?
how is it called?
which gets generated near the build
magical doc page found with google: https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/BuildLayoutReport.html
ok now its loaded
but I can still only see some numbers, but not any info about what assetbundles are loaded
you should be able to see groups and infer bundles from that
You can also add debug code to print loaded asset bundles but depending on group settings their names may be un readable
I can only see a fully empty window
I can only see 22 assetbundles are loaded
86 assets
1 catalog
and that's all
never mind, 0 asset bundle, 0 asset and 1 catalog is there, when I start the game
so I guess I should just unload every assetbundles
my final advice is dont unload bundles handled by addressables or you will probably break many things...
addressables will do this itself if you release things correctly
okay, and how to "release things correctly"?
If you load anything with LoadAssetAsync(), it needs to be released when you are done with it.
If you use InstantiateAsync() then you need to use ReleaseInstance() when done with it (or when it will be destroyed)
If you forget to do this then the asset and its dependencies will never be unloaded as it still has users.
https://docs.unity3d.com/Packages/com.unity.addressables@2.5/api/UnityEngine.AddressableAssets.Addressables.Release.html
https://docs.unity3d.com/Packages/com.unity.addressables@2.5/api/UnityEngine.AddressableAssets.Addressables.ReleaseInstance.html
okay, I just don't know how to identify the addressables, if the profiler refuses to tell me the names
It should, show screenshot of what you see
What unity version is this?
2022.3.61f1
When this works properly for me I see info about what is loaded at the bottom correctly
I presume its broken cus the report is wrong or it doesnt work fully on a build
try in editor with existing bundles (change platform to your desktop platform) to see if that gives the correct detail
well, on the right side, it writes that message
experimental profiler module
I could install a newer unity, but then that would take a whole day, and I wouldn't be able to make a build to NDA platforms anyway
because that would take like a week at least to install every necessary stuff for that
it says this char01 assetReference is invalid
i cant figure out why
i only ticked the addressable checkbox and its supposed to be done ?
{
if (assetReference == null || !assetReference.IsValid())
{
Debug.LogError("Invalid AssetReference provided.");
return null;
}
var handle = assetReference.LoadAssetAsync<GameObject>();
await handle.Task;
if (handle.Status != AsyncOperationStatus.Succeeded) return null;
var prefab = handle.Result;
var instance = Instantiate(prefab);
handle.BindTo(instance);
return instance;
}```
Check .IsValid() on the asset reference
you can also get the runtime key to help with debugging
btw its possible for an asset to no longer be addressable but still be in the asset reference
AssetReference: [e18510a9eeb760e4583a435e068f9ec2]Char01 (UnityEngine.GameObject), RuntimeKey: e18510a9eeb760e4583a435e068f9ec2
it logged this out
used a debugger?
yeah, just debug.log
oh, thanks !
where do I check this ?
maybe before trying to use the asset reference? If you use a debugger you can inspect the object and view these things
ah i thought you mean theres a button for that
the state is false from the start
what are the common reasons for this ?
is it actually addressable still? clear and re set the asset reference in inspector
it wont remove it if it isnt anymore its dumb
@honest halo should I rebuild addressables to make profiler work?
play mode script was in "use asset database (fastest)"
i re set it
even dragged straight from the addressable window
if you want to test in editor i recommend changing to "use existing build" but you need to swap to the plat for your PC (e.g windows) then build addressables then play and check the profiler
then it actually uses those bundles you just built (and report)
yea i dont really get what im seeing tbh. I dont know why its invalid for you but you must be doing something funky with it
have cases like this happened before ?
😆 not to me
am i supposed to make the SO addressable too ?
you can use InstantiateAsync() from asset reference btw, you dont have to load the gameobject then instantiate
No it doesn't have to be
asset reference just keeps the address and uses that to load for you so there is no direct dependency
ill try loading directly
okay it works perfectly fine if i just instantiate the prefab directly
F me

WHAT IS THIS
the other addressables load just fine
I just wanted to try it out
but if I set the addressables window to "use existing build", then I can't build the addressables
that setting should not change how they get built in any way
what does this sentence mean?
in this context
addressable building is not related to the addressable editor mode
did you get an error? compile error?
when I tried to build addressables with that "use existing build" setting enabled, I got errors, yeah
@honest halo
thats nice, if only i could see them
It needs to compile scripts for the platform, is something breaking that?
whats the stack for the first error
there's no stack
InvalidOperationException: Unable to build with the current configuration, please check the Build Settings.
UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)
this is all
second and third is also the same
what platform is currently active? win?
win
PC
fun thing is that on this computer (my home notebook, not the workplace machine) I can't even find the Addressable Profiler
same Unity version though
2022.3.61f1
Its not getting far enough to make it it seems
you may or may not get some more details if you open the full log file
good idea, something is wrong meaning it cannot get far enough
I mean we should also somehow magically make the Addressables profiler appear on this computer
are you sure your home pc is setup to build this project?
because somehow its missing from here
testing it
but anyway
I have never selected that addressable build option yet
I always made addressable builds differently
with selecting the top option
the fastest
that is changing how the editor handles addressables, not related to building them
read what i said
it doesn't affect builds at all lol
then how is that addressable building always worked with that?
you probably have the setting turned on to do addressable build automatically when you build
@sinful siren read the doc section on this, we are telling the truth honest 😆
https://docs.unity3d.com/Packages/com.unity.addressables@2.5/manual/GroupsWindow.html#play-mode-scripts
okay, its just the third day I try to optimize a game, and I don't see if I can finish that this week
and deadlines are coming
If you have not set up anything to release then its gonna suck adding it all in later but its the solution to reduce memory load
a bit of reading the docs up front can save a lot of time later 😉
I can't make build, because Perforce is locking everything even outside of the project folder
even the log files make io exceptions
Work offline is active in Unity though...
somehow Perforce behaves well, when I'm connecting to it
but currently I can't connect to that
my problem is that even if I could build the addressables the correct way
the Unity 2022.3.61f1 apparently using an experimental profiler
and I think I won't be able to see the addressable asset bundles loaded
I have used the profiler correctly in 2022 but i usually only do it in edit mode with existing bundles
it does work and can be used to track things you forgot to release
Try to figure out why it cant build. Sometimes addressable builds fail with no clear error because you have an asset in multiple groups by accident or some other odd problem.
If you can, update to the latest 2022.3 editor ver
e.g im on 2022.3.51
and can you see the Profiler?
I mean the module
because for me its invisible now
yea it works for me, did you hide it by mistake?
I mean I can't even unhide it
if you're on an old enough version there's a separate addressables profiling window in the addressables menu, the profiler module is new
no idea what version of addressables was used in 2022 though
i did prefer the old window though lol
2022 has the profiler module
this is all I can see
and "asset loading" is not the addressables stuff
I'm going crazy
how to reach that? (if its still exist in this version)
it was somewhere under window>asset management>addressables
I know where are addressables
yes, but that's the submenu it was in
I thought you know the old profiler
there's like 5 things in there, it was one of those
well, if its there, its renamed to something chinese I bet
because its not straightforward where is it
okay well i googled it for you lol, it was called the event viewer and if it's not there i guess it's gone in whatever version you're on
ohhhh
so there's a package called "profiling core"
nice
I tried to check for profiler million times
how tf was that even gone
A small demo of what you should see when it works:
you can see it shows the group, the bundle name and the actual asset and its active handles
cool
now I figured out I didn't have IL2CPP installed
so now addressable bundles gets building
I afraid this struggle will be for nothing, since I should sleep in 1 hour
Ahh nice catch. That example above was just me changing to windows platform, building bundles, "Use existing build" setting and entering play mode.
can the AsyncOperationHandles cause a memory leak, if I use Addressables.LoadAssetAsync and storing the handles only in local variables?
if you don't release the handles after loading them, yes
GC won't release them for you
cool
and when should I release handles?
after the handle.complete got called?
when you don't need the asset any more usually
that will be hard to know, but yeah, somehow I will figure it out
we are talking about multiple thousand textures
well it's reference counted, so if it's easier you can let every user of it call LoadAssetAsync and Release individually and Addressables will only free it when the last one releases
and that's the bad wa
way
because release is not get called
I use UniTask with addressables and release the loaded asset instead
yes, you can release either the handle or the asset itself, Addressables keeps track of both
I won't check and find each asset related to the 7000 textures loaded
so I will centralize the addressable asset loading and handle releasing
as long as you do it somehow
because otherwise not all of them will be released correctly
If you remember this requirement in future you can keep it in mind. If a component loads an sprite or texture to show then it can release OnDestroy for example
I was not even the one who wrote these codes
@teal mortar so somehow I can't see addressable bundle names in the profiler again...
but I can see that the count has been decreased
but the texture memory was not released
Guess you need to have whoever you work with read up on this too.
Releasing things correctly will then allow textures to unload
I won't be able to determine that one person
Whoever is in charge then needs to be told this is the fix for memory issues
only after I was able to fix it
because this needs for me more
okay, Unity's addressables profiler is a big pile of sh**
even for the Unity 6
like 1 out of 10 times it shows me the addressable bundles
all other times it doesn't
and I have zero idea why
it is experimental but its been reliable for me and ive used it quite a few times
sometimes it shows me zero addressable bundles, sometimes it shows me 3, and very rarely it also prints their names
but probably not for NDA stuff
I guess
but if you only use it in editor that no longer matters (unless there are platform only settings or changes to addressalbe groups i am not aware of)
I have no idea how to use it in the editor unfortunately
I have no time to convert the whole project back and forth between PC and NDA platforms
because it takes 2 hours until it finishes
with the conversion
and for the NDA platforms, the editor doesn't work, I can't play the game in editor
only for PC
why, I don't know
it should only be slow on the first platform switch and after it should be faster
it crashes out
and I have no time to figure out what makes it crash the whole editor while I use NDA platform
not, when you get million updates each day
to the project
Do you not have resources or help within your team if its updated soo much?
I mean everybody has their own tasks
I could solve this on my own as well, if I would be able to see the addressable bundles
but I can't see it
at this point no one here can help you anymore, i told you already a method i use to do this profiling in editor
You can use this to find all loaded bundles but their names will be shit depending on your settings:
https://docs.unity3d.com/6000.1/Documentation/ScriptReference/AssetBundle.GetAllLoadedAssetBundles.html
this only works in editor if its "use existing build"
goodluck
somehow the window works again
the profiler I mean
I did nothing, I just restarted the profiling and the unity editor and the build a few times
@honest halo is unitybuiltinshaders some kind of basic addressable bundle, which can't be disabled?
or released or whatever
you dont need to ping me anymore i dont have anything else to add
yes its auto managed by addressables so its not something you can manage
then you had things to add....
-.-
