#📦┃addressables
1 messages · Page 9 of 1
Have you tried running the tests here?
First thought is it might be worth looking in the 'top level settings' and seeing if you have build remote catalog enabled? It looks like it's trying to get the package locally.
Hello @mild flax I have enabled the Build Remote Catalog option in the "Addressable Asset Settings" inspector. After that rebuilt the project with the catalogue files as well in the Server folder & uploaded all the assets in the AWS S3 service. Still the problem exists & the same error is coming.
Sorry I've no idea what that's about - you don't have any screenshots referencing this link so I can't guess where it might be coming from. Best of luck! Setting up addressables can be pretty painful but I can say it's possible with enough trial and error.
Okay, I will try to look deeper & try to solve the issue at hand. Thanks anyway for the cooperation.
yes - that's what I'm talking about. After running those tests you get duplicate bundle dependencies, but it's hard to figure out what is actually causing the duplication. There are assets in there that I don't think are actually referenced by things in the bundle
Hi everyone.
I'm having an issue with Addressable.LoadSceneAsync in build.
The AsyncOperationHandle seems to be stuck at 45% while it works well in Editor PlayMode.
(for info, I'm running on Unity 2021.1.22 and Addressables 1.18)
does anyone have any idea why that happens ?
A little more in-depth :
the AsyncOperationHandle.Task seems to be stuck in WaitingForActivation status, thus preventing completion.
I've yet to figure out why the Task is not activated...
Found out by using WaitForCompletion that it is stuck on AssetBundleProvider.GetAssetBundle
More precisely on m_AssetBundle = (m_RequestOperation as AssetBundleCreateRequest).assetBundle; (l.305)
hello, new to addressables just instaled the package on my project but i can't find the name space
already tried updating visual studio
i already made some assets addressable so it's defiantly installed
@thorny bay Are you using vscode, or vs 20xx ?
Is that error showing in Unity console too ?
I had the same error on vscode at some point, omnisharp did not seem to get the symbols loading.
If you don't have that error in Unity console but have other issues for compilation, fix those and it should regenerate the project files with the symbols for vscode to work with.
I fixed it by deleting csharp files in the project
and then rebuilding the project in vstudio
thanks tho 🙂
Found my issue :
I was querying a local .bundle file without file:// before the path in my RemoteLoadPath
Is there any way to set a field on an object created using AssetReference.InstantiateAsync before Start is called on it? In my tests, Start gets called before control is returned to the code calling InstantiateAsync
is there anyone i can screen share with and ask some questions about adressables
and their enormous size
i think i may have duplicate assets
assets which you think are duplicated, mark them as addressables aswell
Hello Team Unity, we are using addressable in our game with voxel play. The issue is that if I add any asset as addressable it has dependency files with voxel play. If I try to add voxel play files as addressable it won't allow me to do because it's assets are located in resource folder and I can't move that out of resources folder it won't work. What would be the ideal solution for this issue?
Hi!
I'm Andrea, from Rortos (an italian game development studio).
We are working on a project using Asset Bundles.
We are having problem with Caching.ClearCahce() function. It returns false.
So we have tried to use GetAllCachePaths() to manually clear all caches.
Every single cache returns true except for one: scenes cache.
Why ClearCache always fail on cache which contains scene objects?
Have you ever seen this problem?
I could be wrong but I think Caching.ClearCache returns false even when it succeeds? At least I think it seems to work reliably for us when it comes to actually clearing the cache.
We are checking the local folder and just those folders where ClearCache return true are really empty.
The one which return false contains downloaded files.
Ah interesting. This is in builds or in editor? I ask because I noticed at least in 2021, it seems the editor has problems clearing some of the cache - leaving files locked? Not too sure tbh - appreciate hearing about anyone elses experiences.
We are using Unity 2020.3.19f1 (LTS).
We are seeing this problem running in UnityEditor
The main reason I can think of that it would fail to clear the cache is if it thought the assets were still in use. I guess that doesn't help much though.
The problem seems to be related to cache size.
If cache is too small and you try to download something bigger, the ClearCache will fail.
I think it's a bug, don't know if it's an only editor bug
??
Is there a good way to share the same asset group between a client and server build that are different projects?
That's what I'm doing with a 3rd content project. No issues so far, just build the remote addressables, then load the generated catalog in your client/server projects
Is there any easy (automated) way to find dependencies between a local group and remote group? (or simply- 2 different groups?)
I found out that having a reference (direct reference, not assetreference) in a local group to something that's marked as addressable in a remote group causes the remote group's bundle to be downloaded when loading the local asset 😵.
I found some of the dependencies by hand (looking at Bundle Layout Preview unfixable rule in Addressables Analyze), but apparently there's more things left that I must have missed...
I expected it to put asset duplicates in the local and remote groups in such cases, but nope 😐
Hello All
This is Pranoy. I am trying to add the audio files in my project to the Addressables group but I am unable to do so. This is because there is no option of selecting the addressable option in the audio import settings in Unity.
Can you please let us know, if we can use audio clips inside Addressables group or not? Or am I missing something?
Did you actually install the addressables package? Audio clips can be marked addressable and the option should be there.
Yes, I do have Addressables installed in my project & I already have added other assets like sprites & prefabs to the addressable groups.
Hello All. Im using Addressables 1.16.19 in my project with Unity 2020.1.17 and running into a weird issue. I use unity cloud build to generate my assets from a azure git repo for my app (live on android and ios) and then push those generated assets to an azure blob storage to update the assets in the app. This has been working great for over a year. I normally make changes, commit to the repo, then in cloud build do an update against the content_state.bin file for each build target.
Recently my azure team enabled Git-LFS and specifically targeted FBX files because the repo was getting too large to generate builds via azure. This obviously caused issues when I generated assets because the FBX files were no longer directly in the repo. My assets would still appear when placed or used in the app BUT without a model/mesh. When this was discovered I immediately removed all LFS stuff and recommited all the FBX files. However, doing an update to the addressables via the method above did not fix the issue.
So I grabbed an older content state.bin from version control pre-GitLFS and updated addressables against that and it fixed the issue - for Android. But grabbing the same comits content state bin from the iOS folder and updating iOS assets against that state bin did nothing. Notably a git compare between the current content_state.bin and the older version say they are the same anyways. But now even when I update current assets the changes do not seem to be taking effect after building assets.
Does anyone know what could be going on? Or if not does anyone know if there is a way to generate a brand new clean set of addressables for the current build player (ie - not generating a whole new build of the app, just the addressables) via cloud build?
hi, uh it might be a dumb question.. but having the prefab (containing a mesh and material with texture) in the addressables should pack everything together, right?
yeah, you can go to Addressables Analyze window and check out the "Bundle layout preview" unfixable rule, it will show you the explicit dependencies/content (which will containt the prefab) and the implicit dependencies - so the mesh, material and texture
Thanks!
With Addressables, can I store the Result from an AyncOperationHandle in a variable and pass the variable to the Release() method? Or do I have to pass the operation handle?
A addressable prefab I have is referencing a scriptable object. When creating an instance of this prefab (via LoadAssetAsync then GameObject.Instantiate) the reference to the scriptable object becomes a different reference than one on a component in the scene from the start, so equality comparisons don't work. Any ideas how to prevent this?
Yea this super sucks. Afaik you either have to a) ensure the SO doesn't end up in the asset bundle (I think this works depending on your situation) or b) replace the SO on the prefab with the one in your scene once it's loaded. This latter option can be difficult as you need a way to tell that two SOs are the same in principle.
yeah - I managed to google correctly and found some forum posts about this too. I was hoping there would be a way to check equality via something "deeper" like what the addressable SO was created from, but it doesn't seem like that exists
option (3) is make sure there are no scene references to the SO, everything comes from the bundle, I think?
option 3's valid yea 👍
fwiw I created asset partially to help with this problem (it's called BTagged) but you could create something similar if needs be. Basically you inherit from it instead of SO and it gives you a .hash that's unique per asset.
I have unity 2019.4.3f1 and want to reduce my build size. (It's more than 500MB with just half of the app content ready.)
I googled and found out about addressables which seems really good. So should i just start with the docs as this:-
Thanks for the hash idea - I ended up implementing something probably similar after trying a couple different approaches
Word of warning to watch out for when assets are duplicated. Also hot tip: ctrl+drag is handled differently to ctrl+d
Hi I got this bug when try to load model 3d remotely, anyone know how ti fixx this?\
It means your Meshrenderer either has no material or the material is using an unsupported shader
the model itself loaded fine
thank @low halo ! I figured it out. It's only happen on editor(2020.3.21f1) but work fine on the builds
Seem it's a unity bug when loading assetbundle remotely on editor?
the assetbundle's data is right but unity editor can't load the shader
just click the Lit again then it will work on editor
Sort of wacky, but if you have one main character that is a constant throughout multiple levels or scenes, is it better to have the one character on dontdestroyonload, to keep him throughout the scenes, or a prefab of the character with the same stats?
I have a question in video form: https://youtu.be/CDGdfuNFY98
Starfighter General: One MMO to rule them all and in the light free them: https://www.starfightergeneral.com/
Starfighter General: A soul gamer indie in the age of boring corporate spew.
This action MMORPG will have live game masters. Those who role play well whether good guy bounty hunter, bad guy pirate, emporer or whatever will attract th...
We're having an issue in our HDRP project where skinned meshes loaded via addressables don't participate in indirect lighting, any ideas?
hi how can i pack CompatibilityAssetBundleManifest after sbp? like old build pipeline's output
is it possible to get addressable final path? The one from which given addressable will be downloaded
has anyone else had an issue with children of an instantiated addressable prefab lose the layer it was on?
@wary mantle Don't cross-post, use relevant channels.
I am getting this error when I try to load my assets from server. Any solution?
Is there any way to profile how long it took the addressables system to download a bundle, and how long did it took to decompress and load a bundle?
Hey guys
I have a question about Asset Bundles, If I have two separate projects, one for creating DLC (A) and the other the main project (B). Can I create an Asset Bundle in Project A and then, create a bundle. Then after creating the bundle, load it in Project B? Right now this doesn't work for me using Addressables. Also Addressibles does not seem production ready
You can do that with addressables https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/MultiProject.html not sure about pure asset bundles
Hi, I am in need of suggestions.
I am creating a Mobile game and it contains a lot of objects (roughly 3000 static objects per level) but also a decent amount of levels (20 levels currently)
When the game was a bit smaller (10 levels), it ran more efficiently.
We believe we have optimized most things but it comes mostly down to the amount of objects we have in the game.
We currently store each level in a prefab but these prefabs are also referenced in the scene so we understand that they are all loaded into memory and may cause the increase in lag.
We are looking to only load each level when need but the difficulty comes from the fact that each level mostly shares the same objects.
We have recently tried using Addressables but to no success in performance and I understand that we implemented everything correctly.
We are looking into using "Scene Streaming" next and storing each Level in another Scene. Will this work by any chance?
Also, any suggestions for improving performance is greatly appreciated!
anybody know why .waitforcompletation freeze on android?
turns out you can do that with asset bundles and addressibles fail
Not sure where you get that, I'm using addressable for a 3 project setup. Client and a server projects that load addressables from a 3rd content project.
We pull in cataloges from 3 different designer projects also, works fine here. That being said addressables does feel a bit rocky still.
yeah it works 100% of the time using asset bundles. I am not sure what the disadvantage of an asset bundle is
something about memory? but couldn't you just build something that holds the references and removes them as you go ? :S
Hi Everyone!
I'm using addressables to distribute remotely content updates. I have a question regarding how the client updates his content. In my design the client checks for updates when the app starts and forces the player to download before continuing. I have implemented this calling sequentially:
1 - Addressables.InitializeAsync
2 - Addressables.CheckForCatalogUpdates
3 - Addressables.UpdateCatalogs
4 - Addressables.GetDownloadSizeAsync for each of the keys of my catalog to get the total download size
5 - Addressables.DownloadDependenciesAsync to download those keys that returned a size > 0
this works properly, but there's a small issue I would like to fix:
steps 1, 2 and 3 download the catalog hash from the CDN. I'm fetching it 3 times instead of one and I would like to minimize traffic to the CDN.
Has anyone found this situation?
somone please tell me how do i get purchased data from gamefoundation and use that to change skin of player 2d
there's no "disadvantage" to using asset bundles. Addressables is a system built on top of asset bundles. It still builds and loads asset bundles. It just makes managing them easier
Perfect
Are addressables really better than the resources folder?? Apart from the remote setup everything else feels the same
They solve different problems. They can split up your final game so you might not need to publish everything to everyone.
Hey guys, I just wanted to clarify. Is it every time I launch my application when there is internet, unity will update the addressable from cache?
I know when I don't have internet it will load everything fine. I just want to know because some of the cache file can be large and with a good number of users it can incur a charge from AWS.
So i just want to know when does unity update the addressable cache, because I was just wondering if it is just when a change is made to cache files?
I couldn't find a conclusive answer to this, so apologies if an answer to this already exists.
I'm getting into Adressables and have a question about moddability.
As far as I understand it, I'd load the built catalog of the mod by filename.
I'd like the user to overwrite existing game data tho, i.e. modifying existing Player Stats. How would I approach that?
Loading a new catalog would load them alongside the existing ones, as opposed to replacing them.
And unloading a catalog isn't possible, is it?
Even if it was, AssetReferences would then lose their reference as it's tied to the GUID, which includes the Catalog, right?
Addressables should check the .hash file that sits next to the catalog is different before re-downloading any content. i.e. if you have things set up right, I believe it should at most just request the catalog.hash file every time and only download the actual bundles when needed.
This depends upon your configuration. The hard part is if you want to update mid-run - i.e. whilst your app/game is running. In that case I don't think there's anything that could automatically do it for you - what's required would be very dependent on your setup I would expect.
Wait, it's possible to replace them?
But yeah, it is required to do so while the game is running.
Thanks @mild flax, that's definitely cleared things up for me. Appreciate it.
I actually do have the moddability implemented, but using Resources and JsonUtility.Overwrite. It works, but using Addressables would be nicer as the modders could use Unity itself and my custom editor scripts for a nicer modding experience.
There's a related note in the 'important' section of this page: https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/LoadContentCatalogAsync.html
Good to hear but also... don't take my word for it 😄 - make sure you do some tests
Lool, yeah true true. I should do that to be certain. But what you're saying though does make sense too.
How should I go if I want to move all the implicit dependencies of a bundle into the explicit ones?
Is it something I can do via code?
(this is just a step towards what I need to achieve)
Hello, I am using addressables in my project to reduce apk size. I have my assets in s3 and it loads perfectly in editor. However when I build for android it throws this error. RuntimeData is null. Please ensure you have built the correct Player Content.Any solution?
Can someone confirm that an AddressableAssetEntry cannot be part of multiple groups? Can't find this anywhere in the documentation
Do Tilemaps work with Addressables? I don't know how Tilemap serializes its Tiles, but I'm guessing its hard references to the Tile ScriptableObject? That would break the Addressables system.
Do I have to completely rebuild all my addressables from scratch every time I'm doing a full app build? If I make no changes to my addressable assets (e.g. just a code change), can I not cache what I got from the last build?
Why is it so hard to get rid of Unity standard shader dependencies? anyone knows hot to do that? I overwrote all model importers to use a custom material, but there are still dependencies i can't track down
Please help, tried everything to fix it - Releasing render texture that is set as Camera.targetTexture! Context : Android, using custom render texture (asset) in the addressable prefab. When releasing gameobject via addressable release instance - it always throws this error. What should I do?
what error?
hey so this happened to my unity and I dont know how to fix it 
load a backup. probably some version upgrade bug
Not sure if this is the right space to ask this. I used to have a texture (2D Sprite) assigned to a game object and in the editor it shows the texture just fine. When you play, it proceeded to show the texture just fine. Idk what I did, but I edited, moved, and renamed some stuff. I reassigned the new texture onto the game object as an image (source image) just like I did before. Absolutely the same exact steps. Shows the preview perfectly fine in the editor mode. However, when I play, suddenly it's just plain white instead of the actual image. This seems like an obvious problem but can't get myself out of it. ANy tips?
I have confirmed that the image I'm attaching to the image component of my gameobject is indeed a Sprite (2D) with the correct parameters. It works perfectly fine up until I click play. Then I just get a white fill instead of my texture
And that same source image / texture works fine on any other game object except this specific one. Which I just found out. So furthermore points to the game object for some reason
Yikes. That one is on me. Was editing the object outside of the prefab and needed to modify the prefab. 😐
I don't know if I should ask this here but
I have a folder which contains scripts. When I load an AssetBundle, the desired GameObject (prefab) instantiated on scene load the scripts from the Local Script Folder (with their custom values). So, should be possible to Drag N'Drop the Prefab and save it with all the values. But after make it, the scripts references are missing. I must see the Prefab instantiated, tell the (same) Prefab from my project the specific scripts that are lost after import it, and assign the values manually
Why?
Can someone explain to me what the "key" is in this? https://docs.unity3d.com/Packages/com.unity.addressables@1.14/manual/DownloadDependenciesAsync.html
how do I know what my key is etc?
A key can be one of the following objects:
- Address: a string containing the address you assigned to the asset
- Label: a string containing a label assigned to one or more assets
- AssetReference object: an instance of AssetReference
- IResourceLocation instance: an intermediate object that contains information to load an asset and its dependencies.
https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/LoadingAddressableAssets.html
Does anyone know of an API to know whether addresssables is building atm?
When building addressables an Awake is called, and that destroys objects. This shouldnt happen during the build, so i'd like to test this.
Its not BuildPipeline.isBuildingPlayer, nor EditorApplication.isCompiling
Anyone knows how including shaders in addressables work? what happens with .cginc files for example? they are not referenced as dependencies, should they be included too?
From the perspective of what is included, its a reference in the material like any other.
You can see this if you have serialization to text mode, and open the material in a text editor. It refers to some texture by GUID, and the shader by GUID. No different.
CGINC files dont exist in runtime. When the shader is compiled quite literally, the contents of the gcinc file is copy pasted in the shader file.
Thank you for clarifying! I suspected that, but I wasn't sure.
What about hidden shaders though, they might be referenced in code and nowhere else, so I guess I have to manually add them to a group if I don't want them t end up in the -all-other-stuff-remaining bundle, right?
How do you refer to them in code? Shader.Find?
yes
(it's not my code, i would have referenced explicitly for better tracking)
(but I'm not confident modifying assetstore stuff as it's difficult to track and might be overridden with updats)
does that change something?
Yes, with Shader.Find unity cannot find your dependency, and it wont exist in your build.
but they still get added in the build, just in the generic assets bundle, no?
No, there is no generic asset bundle. No all other stuff remaining bundle, that doesnt exist.
then how is it that even if i'm not incluing the shader specifically, it still doesnt throw an error 🤔
Then something else references it. Look foor buildstep.json
Testing to make sure I can load new addressables dynamically from an existing build, and I ran into this. Any ideas on what might be causing this?
Hey guys, is it possible to only update one addressable group from a project?
The reason I'm asking, my project uses a lot of groups to separate content. But i might want to update one or two of them, rather than having to build everything out every time.
That's why i'm asking if its possible. I couldn't find anything on google. So i though I would ask.
It's likely possible, but you'd have to make your own build script for this (you'd build your groups, and you'd generate an updated catalog file after that).
It's possible to maintain several catalogs as well (I do it with separate projects, but it is possible to setup something on a single project).
Thanks for that. I never though of doing my own build script, but I guess that's the way. Many thanks.
Is there an interface I can implelement to run a script automatically after addressables build ?
Then you can either just add your custom stuff at the end of the build script or create your own event that fires after the build for other code to latch onto
Thank you ! Seems like something than could help me, i'll have a look at this
I am trying to make a webgl build with addressables
standalone x86_64 build works fine
and webgl build works fine in play mode
but it does not work when i upload it to itch
<Link to my addressable bundle>.hash:1
Failed to load resource: net::ERR_FAILED
index.html:1
Access to XMLHttpRequest at '<Link to my addressable bundle>' from origin 'https://v6p9d9t4.ssl.hwcdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
<Link to my addressable bundle>
Failed to load resource: net::ERR_FAILED
0.1.1.framework.js.gz:2
RemoteProviderException : Unable to load asset bundle from : <Link to my addressable bundle>
UnityWebRequest result : ConnectionError : Unknown Error
url : <Link to my addressable bundle>
_JS_Log_Dump @ 0.1.1.framework.js.gz:2
0.1.1.framework.js.gz:2
OperationException : GroupOperation failed because one of its dependencies failed
RemoteProviderException : Unable to load asset bundle from : <Link to my addressable bundle>
UnityWebRequest result : ConnectionError : Unknown Error
url : <Link to my addressable bundle>
_JS_Log_Dump @ 0.1.1.framework.js.gz:2
80.1.1.framework.js.gz:2
System.Exception: Dependency Exception ---> UnityEngine.ResourceManagement.Exceptions.OperationException: GroupOperation failed because one of its dependencies failed ---> UnityEngine.ResourceManagement.Exceptions.RemoteProviderException: Unable to load asset bundle from : <Link to my addressable bundle>
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
_JS_Log_Dump @ 0.1.1.framework.js.gz:2
80.1.1.framework.js.gz:2
OperationException : ChainOperation failed because dependent operation failed
System.Exception: Dependency Exception ---> UnityEngine.ResourceManagement.Exceptions.OperationException: GroupOperation failed because one of its dependencies failed ---> UnityEngine.ResourceManagement.Exceptions.RemoteProviderException: Unable to load asset bundle from : <Link to my addressable bundle>
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---```
this is what i got from my web browser debug console
Where are you hosting your asset bundle?
aws
I'm not familiar enough with AWS to know how to fix the problem, but the error message seems clear enough; AWS is configured to forbid cross-linking to those resources from other sites. You'd need to change its configuration to allow link origins from Itch's servers (might be tricky, as Itch can change where you're hosted without warning) or just allow all cross origin requests for those resources.
standalone pc build works fine
with AWS
Well, yes, it would. Your PC build isn't a web site, it's a client; there's no cross-origin requests happening there, just a client asking for a resource from a server.
The problem is that the CORS policy is forbidding requests for the resource from a web site hosted on a different server (in this case Itch or Unity Play).
Unity offers a hosting service, which I believe has a generous free tier. That is what I plan on using for our projects. That said, I have no personal experience yet with hosting services for asset bundles.
My guess is that most of them would forbid cross-origin requests by default; it's just sensible security practice. So whichever one you use you'll probably need to dig around in the server configuration?
When entering Play Mode with a scene in the Editor which is in an Addressables group, does Unity load dependencies from Addressables? Or would it load them through the standard system (I am unfamiliar with what you would call this) and cause duplication?
If Play Mode is entered, I have a script run which unloads all scenes and reloads them through Addressables.
I thought this was required to avoid duplication, but Unity Open Project 1 does not perform this reload. So I am unsure if there is a workaround I am not aware of.
i think it does load the dependencies
give it a try
I am not sure how to check. When I later load a scene through Addressables, it loads the dependencies twice, and they have different GUIDs. The Event Viewer shows only a single use of the resource, not two. But I don’t know if that is just a quirk with loading it through the Editor first
It does whatever is selected in the "Play Mode Script" dropdown in the groups window; I believe the default setting is to load addressables directly from the asset database in Play Mode.
(Though it's possible I'm misunderstanding your question.)
I have a scene loaded in the Editor. That scene is also in an Addressables group. When I hit “play” to enter Play Mode in the Editor, does it correctly pass the already loaded scene through Addressables so that shared dependencies are correctly marked as loaded and are not loaded twice when I later load another scene through Addressables?
I am currently trying to figure out how to test this to know for sure
It looks like duplication is only happening with the Use Existing Build script, but that has me concerned that there are still issues that are just being masked by the other two Play Mode Scripts.
I'm getting this error (5 times) when trying to load a bunch of addressables, and my async operations never complete. Is there a way to get some useful info from this?
https://hatebin.com/vqdjeqruas
Hello Everyone, just a simple question : How can I apply "Simplify Addressable Names" via script ??
When building manually and calling AddressableAssetSettings.CleanPlayerContent(); when we're done, there's still a AddressableAssetsDAta/<platform>/addressables_content_state.bin file left over. Is this intentional? We want that to be removed when doing cleanup, I'm curious if there's a more proper/idiomatic way other than using System.IO to delete the folder using ContentUpdateScript.GetContentStateDataPath() to get the path.
What's the difference between addressables and serialzedfield?
You both set in the inspector and both use to instantiate
the main difference is that when you reference something directly with a serialized field it gets loaded into memory immediately when the thing that references it is loaded.
For addressables it's merely a lightweeight asset address that gets loaded immediately, and the full thing isn't loaded until you ask for it.
Thanks for the reply,
Another question when i reload from remote does it update the asset on build or when playing?
I made the remote files a set them on the online drive but does the build pulls the files and updates or when i launch the game?
Hello everyone, I have a question, not sure if someone with more experience could have an answer.
I've been working on a project where I'm synchronising the appearance of networked players by sending the AssetGUID of an Addressable through a System.Guid object and then recreating the AssetReference on the client, but since I updated my project to Unity 2021.2 and the latest Addressables version this stopped working, doing some tests it seems the Guid format is not normalized when creating an AssetReference while the main Addressable system requires the Guid (RuntimeKey) to not use dashes (The default behaviour of System.Guid.ToString()) otherwise it will throw an InvalidKeyException, this was working before, not sure what might have changed, but the question is:
Should I be using a different container (In general, not network specific) for the GUID of the AssetReference or is there some best practices I could refer to based on my use case?
Thank you
If possible, since this is going over the network, instead of sending the string version of the GUID, why not send the raw bytes (16 bytes) and construct the GUID from bytes as well.
https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=net-6.0#System_Guid_ToByteArray
https://docs.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-6.0#System_Guid__ctor_System_Byte___
That should be consistent and also more performant/less bandwidth to boot
Bumping this question again since it's been a couple days... Still not sure how to appraoch this.
This possibly isn't the most helpful answer, but I would just debug it? We have source for the addressables library, and it's a straightforward null reference exception, so I would start by looking up exactly what it's dereferencing and following back where the null came from. Unfortunately I don't have that version of the addressables package handy so I can't check the file and line myself.
Hi, this is about asset bundles but I think this will be the appropriate channel..
Have any of you got this error while downloading and loading the asset bundle from the web :
failed to decompress data for the assetbundle 'memory'
Any ideas on how to deal with it?
Hallo. I'm trying to build separate version of our game and demo. my first thought was to have separate groups for main_scenes and demo_scenes which would have overlapping content but the demo_scenes would only include the scenes used in the demo. I'd then uncheck "Include in Build" for which ever one wasn't going to get used before building.
The big problem I'm hitting is that if i add a scene to demo_scenes it is then removed from main_scenes.
Any ideas how i can stop this?
So a colleague added Addressable Assets to our project, and upon checking out the project with the new addressables dependency, Unity touched the AddressableAssetSettings.asset file adding my local computer IP (to my colleague's already listed local IP). This doesn't seem sensible to me. Is there a way to prevent Unity from adding the IPs to the code base? I haven't seen any serialized editor property for those settings, so I also wonder what those are?
The changed and added private IP addresses, are those of two different local adapters I have on my development machine. These are also listed when starting a local asset hosting server. I assume this allows game clients to use my local Editor for downloading the assets. However, having those IPs in version control seems bad, as it will keep touching those files in a team environment.
Eventually through bisection I was able to find the references that were causing me trouble and the fields within them that seemed to cause the issue. Luckily those fields were not (currently) in use so I was able to remove them. Still have no idea what the issue was. The fields in question were AssetReferenceTextures on some ScriptableObjects that were themselves being loaded by Addressables
I don’t have a solution unfortunately, but I did discover that this is only an issue with Addressables 1.19 and not 1.18. I am hoping it is a bug which will be fixed soon, because I could not find a way to disable it and it is causing noise in our repositories as well.
It also seems to store the private IP regardless of whether you are using the hosting service or not. So removing local hosting services likely won’t fix the problem.
I don’t know if it’s possible to have the same scene in multiple groups. How I would fix this problem is by creating completely separate scenes for the demo to prevent overlap.
I get these errors/warning every time I exit playmode. I'm not currently doing anything with addressables, so I know it isn't on my end. I tried deleting the Library folder, but no luck there. Any ideas? (Fixed, it was caused by the localization package not being setup)
thanks, yeah i figured that was the case, so now have a group thats always included and one thats only for the release 👍
Thanks a lot for the reply! That's good to hear, that it seems version specific and probably a bug. I feared it was a design choice 🙈 Yeah, I tried disabling local hosting services but it would always inject my local IP into the settings file. I'll do my next stop at the Unity forums, to see if I can find out more. Thanks again 🤜 🤛
I created a bug report for the current unsuitable behavior of adding local IP addresses to VCS-tracked files https://fogbugz.unity3d.com/default.asp?1385291_nnjsi4diup9cul2h
Found a workaround. Git smudge filters, that automatically replace local IPs for you when checking out / committing. Sharing the solution here: https://gist.github.com/moonshinebot/ca9770650e17c72b3e242e031d3e3a2b
Or just put the affected asset into gitignore
Since the file also contains shared configuration, adding it to .gitignore would lead to devs not noticing when"real changes" are made that they need to add to VCS. Ultimately, all is a compromise, but smudge filters seem to cause the least amount of issues in team environments.
Oh wow, that’s a clever workaround. Thank you for sharing!
I'm trying to use LoadAssetsAsync with a string[], however the method call is preferring the deprecated IList overload instead of the IEnumerable overload. How can I fix this?
How can i update to api 31?
Cast the string[] to an IEnumerable<string> when you call the function?
I mean yeah, but isn't a string[] also IEnumerable? So shouldn't it prefer the non obsolete one?
Perhaps it should, but your question was how to fix it, right?
Yeah that was my question thanks!
If you're instead asking why it happens, I believe C# picks the more specific overload without considering deprecation, and since IList[] is more specific than IEnumerable it's the preferred choice. As such deprecating the IList version was probably an incorrect decision; they should have just removed it and let calls silently fall back to the IEnumerable version. (Assuming the two methods do the same thing; if they don't that's its own horrible can of worms.)
Yes I agree, thanks for the detailed explanation. I wasn't aware that's how overload preference works.
Heyo! I'm trying to build a Preprocessor to automatically exclude all the AddressableGroups from our game's demo build (as it only needs a limited amount of game content)... but I'm getting this error:
UnauthorizedAccessException: Access to the path is denied.
System.IO.Directory.Move (System.String sourceDirName, System.String destDirName) (at <695d1cc93cca45069c528c15c9fdd749>:0)
AddressablesPlayerBuildProcessor.CopyTemporaryPlayerBuildData () (at Library/PackageCache/com.unity.addressables@1.18.19/Editor/Build/AddressablesPlayerBuildProcessor.cs:62)
AddressablesPlayerBuildProcessor.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.addressables@1.18.19/Editor/Build/AddressablesPlayerBuildProcessor.cs:46)
public int callbackOrder { get { return 0; } }
string[] _excludedGroupNames = new[] { /* various keyboards, not important */ };
List<AddressableAssetGroup> _excludedGroups = new List<AddressableAssetGroup>();
public void OnPreprocessBuild(BuildReport report) {
Debug.Log("MyCustomBuildProcessor.OnPreprocessBuild for target " + report.summary.platform + " at path " + report.summary.outputPath);
var addressableSettings = AddressableAssetSettingsDefaultObject.Settings;
foreach (AddressableAssetGroup aag in addressableSettings.groups) {
if (aag != null) {
Debug.Log("Processing " + aag.Name);
BundledAssetGroupSchema bundledAssetGroupSchema = aag.GetSchema<BundledAssetGroupSchema>();
if (bundledAssetGroupSchema != null && _excludedGroupNames.Any(c => bundledAssetGroupSchema.name.Contains(c))) {
bundledAssetGroupSchema.IncludeInBuild = false;
_excludedGroups.Add(aag);
addressableSettings.SetDirty(AddressableAssetSettings.ModificationEvent.GroupSchemaModified, aag, true, true);
Debug.Log("Excluded " + aag.Name);
}
}
}
}
public void OnPostprocessBuild(BuildReport report) {
var addressableSettings = AddressableAssetSettingsDefaultObject.Settings;
foreach (AddressableAssetGroup aag in _excludedGroups) {
if (aag != null) {
BundledAssetGroupSchema bundledAssetGroupSchema = aag.GetSchema<BundledAssetGroupSchema>();
bundledAssetGroupSchema.IncludeInBuild = true;
addressableSettings.SetDirty(AddressableAssetSettings.ModificationEvent.GroupSchemaModified, aag, true, true);
Debug.Log("Restored " + aag.Name);
}
}
_excludedGroups.Clear();
}
}```
the asset groups are actually modified correctly, but when the build actually start (so right after IPreprocessBuild has executed) I get the error I pasted above 😦
Soooo...Addressables doesn't support just any file types huh, what a FRIGGIN let down!
what files types does it not support?
So, it’s now clear to me that “include in build” refers to the AssetGroups build, not to the game build… which brings me to my next question:
How do I avoid certain groups to be added to the GAME build?
Is it something I have to do during the build process, or do I have to strip them from the game build AFTER?
ZPT files…
Can someone help me understand addressable more? So I am trying to use with WebGL, I have created a prefab that has a collection of different sprites under one parent. I tested the loading from Unity CDN in the Editor and I got the prefab to instantiate, my problem now is the objects come in pink, with none of the sprites showing, what step did I miss?
sounds like the materials didn't come in properly
check your renderer(s)
Can the issue be replicated in a build?
Does addressable not bring the dependencies when you add them to a group? Do I have to add the material too?
I have a similar problem with asset bundles. In editor everything loads fine but certain TMP and spine materials render as pink in editor. Work just fine in a build no pink
it should bring dependencies, but I don't know the details of your situation
I can see the correct shader assigned in the inspector too. But I need to basically reassign it for it to show up in editor.
I haven’t tested building yet to see if issue persist. I can’t test a moment so I have to see later…
I’ll send pics later…
Figured out what the issue was, I built the project and was able to load the addressables. What was happening is that I have a post build code that removes the StreamingAssets folder for other parts of my project that use it inside the editor (I eventually delete this folder after build since I will be downloading my assets so I just wanted to automate the process and remove the folder with a post build script). Apparently Addressables saves a folder in the Streaming Assets folder which eventually gets deleted thus not allowing the assets to load...
Hi! 🙂 Does Application.backgroundLoadingPriority = ThreadPriority.Low affects Addressables.LoadSceneAsync?
Hello, I'm trying to create a tool for my game ( the game is separated into two projects : the Main game project and the other project has the content of the game ) so in my content my project I want to able to Build Player Content for any platform I want without changing the Build target In the Build Settings.
What I tried to do is that I made a different profile for each platform and when I change the build target in my tool it changes the profile related to it, but it didn't work and I got this error :
"The file can not be loaded because it was created for another build target that is not compatible with this platform"
What are the possible ways to do this ?? Please if you have an idea tell me and Thank you in advance.
I don't know, I think you have to build directly from that platform...
Hey @marble bay thank you for the answer, that's my last choice I'll wait maybe someone have an idea
Hi, I don't know much about addressables and I am not able to find out answer for my question. I need to make loading at runtime for ex .fbx model from specified user's path and I am wondering if it is possible to do via addressables or I something misunderstood?
Yes…
yes - I misunderstood or yes - is itpossible? 🙂
I don't believe Addressables will help you with that, no; it still uses Unity's build process and asset bundles, it just changes where you load those files from. To load an FBX at runtime you would need to include an FBX library in your game and process it into a mesh yourself.
thanks for your reply I already find it out and decided it will be better to load .obj at runtime 🙂
Can I ask about Localization here? since this is the channel I can find somehow related to Localization.
The thread: https://forum.unity.com/threads/smart-strings-local-variable-references-get-lost-on-runtime.1209598/
Does anyone know why the addressables build folder seem to be destroyed during the build process?
Trying to move away some unneeded bundles OnPreprocess, to move them back OnPostprocess, but while the first operation works, the second one doesnt :S
hey guys, my project has custom mapping that uses asset bundles to load maps that players can create using unity. I have a system setup that strips all the textures from the bundle build that are already included in the built game files (default assets) to reduce file size
up until now, i was using the resources folder to load these assets
im fed up with this system cause each time i update the game, a huge update is sent to steam (several gb even with nothing moved in the resources folder)
im trying to figure out the best way to handle what i want to do, and im thinking of using either asset bundles for the textures, or the addressables system
my question is this: if i were to bundle say 150 textures into an asset bundle, and i needed to load only about 15 for a specific map, does unity have to first load all 150 textures in the asset bundle before i can apply the textures i need to their materials?
and, if you know of any better way to accomplish what im trying to do, please let me know!
The “Memory Management” section of the Addressables manual says that an asset bundle’s contents can be partially loaded, but not partially unloaded. So you should be able to load those 15 textures, and as long as the other 135 textures in the bundle aren’t referenced anywhere they should remain unloaded. However, once you load those 15 textures, they will remain loaded until there are no more references to the asset bundle they were contained within. This means that when you load another group of textures for another map, the textures you had previously loaded will not be unloaded.
You will probably have to experiment with this using the Event Viewer to find an arrangement that works for your situation. You may need multiple bundles to ensure that textures are unloaded when no longer needed.
Edit: That said, what you want to do with custom maps where players can create them within Unity and then get loaded by the game is a fairly advanced use case and is outside of my experience with Addressables. Because of this, you might have additional issues with loading the textures that I am not aware of, and I can’t comment outside of asset bundle partial loading.
Can Unity Addressables be used to add more content to unity post launch? Like say I have 10 sprites in a folder and later add 10 more post release, i would like to load the new 10 sprites into the game without having to update the application. Sorry for the cross post
yes
thanks so much dude, you have answered my question completely
Hey guys, I am testing Addressables and am getting this error:
Thats an old file that was deleted, a new catalog was created today, why is it looking for old one?
It apparently still loads the object with the new catalog but I still want to know why its calling for an old catalog...
Now testing in Chrome Browser works with downloading on Macbook (instant download too), but when I try it on mobile it takes like 20 times longer to download on the same internet speed...this is NOT good obviously since the file isnt even that big, what gives? Anyone have ideas?
After some more tests, it’s the Addressables.InitializeAsync that’s having the problem. The downloading is quick, but initialization takes long, any ideas to reduce time?
System.Exception: Unable to load dependent bundle from location
I am using Unity CCD to host the bundle
but for reason it always fails to load the bundle
I have checked the "Build Remote Catalog"
And the path seems to be fed by the editor itself since I've linked the project
I am running the editor in the "Use Existing build" mode
This is what I am doing in the script to load the textures from the remote path
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I've set the label name to individual sprites in a folder and uploaded the bundle using "Build and Release"
nevermind got it to work 😄
Hello all, has anyone else experienced the components on a GameObject loaded through InstantiateAsync calling their Start method immediately?
for example
GameObject go = await operationHandle.Task;
//Above GameObject's components fire their Start methods here, and then the next line of code fires
return go;
When I instantiate a Prefab, for example, this is not how it works.
Yes; in my experience that is how all instantiate methods work if the component is active and enabled, nothing unique to InstantiateAsync. Sorry, this was wrong; I always get OnEnable and Start confused for this.
Done with work for today, but I will have to make an example project to test my own sanity about this
I am 95% positive that Start methods on components don't immediately fire as soon as I call Instantiate(prefab)
They don't you're right. Awake and OnEnable do, Start doesn't - but I don't know at what point instantiateAsync's operation handle considers loading to be complete. It's possible it waits until Start is called.
do people have experience working with asset bundles and unity cloud build?
I'm not sure this is the right channel
if there is a channel more closely related to that pls lmk
I'm having trouble making unity cloud build generate the asset bundles for each platform
I think this also came up on the Unity forums a few weeks/months ago, and I'm not sure whether it's a bug or not. On which version of Addressables are you? Because it might've been fixed in a later version already if it really is a bug.
I figured out this issue, this file is created during the build of the game so it needs to be available at all times. I deleted it when I uploaded a new addressable catalog. I wish there was a doc stating the required files needed at all times...
Thanks, it is possible that it's the version of Addressables we are using that is the problem, yes. We try to stay on verified versions, and the verified version of Addressables is quite out of date now.
In my exp verified has as many bugs as non-verified versions. I assume the only difference is that it's an editor+package combination passed some automated tests or something. Like most packages, every version has a different set of bugs - generally the more recent bugs are less bad than the older ones, though not always. We approach this by just trying (if we have issues) then rolling back if the issues are worse.
@lunar shard I concur with @mild flax here. A verified package in case of Addressables doesn't mean much. I think 1.17.17 was one of the more stable release after 1.13.11.
I wouldn't hold back on updating tbh to the current latest one as it seems quite stable (at least in our scenarios)
I agree with you.
Does anybody have some experience with asset bundles?
I am facing this strange issue where when loading the game via asset bundles on a mobile, makes the polygon and the edge colliders stop working
It is fine in Editor, though
Really puzzled about this, anybody have any ideas regarding this?
Have you tried doing a clean build of the bundles?
sorry wrong channel
Why doesn't this show up when trying to use it on a Unity button?
but string and int argument does
Cause button only support string, int, float and byte
why no addressable
Any ideas of a good workaround? Is there a way to load an addressable with a string?
nvm, found it
Yep did so but no dice
But did manage to solve it by turning off "Strip Engine code" in Player settings. That fixed it.
guys i got this error and i have no idea to fix this.
i'm trying to get all prefabs by Addressables.LoadAssetsAsync
Could you share the relevant code please?
Looks like #📦┃addressables message same error
for some reason i couldn't send that code in this channel 😩
Have you fixed the problem yet?
Yes
basically I had some empty asset references in some of the assets I was loading and that was breaking things
I don't know why that was breaking things but I removed that field since I wasn't using it anyway and it worked
While debugging this issue, I discovered a different unexpected behavior: If you load an asset through that code, and the asset has sub-assets, such as a TMP_FontAsset, it will attempt to load the root asset and all the sub assets. This causes an exception due to a type mismatch between the root asset and the sub assets. This is solved by supplying the type to LoadResourceLocationsAsync().
This is documented in the Addressables manual under Using Addressables at runtime -> Loading Addressable assets -> Loading locations of sub-objects. This was unexpected for me personally, so I thought it might be worth bringing up, in case it’s helpful to someone else.
is there a good guide or tutorial to getting asset bundles set up
i followed the unity offical page on asset bundles, but its not working, at least not in edit mode.
i just skipped those error and they worked like nothing happen. that weird 😅
It is pretty strange. I spent 6 hours yesterday attempting to intentionally break Addressables in this way, and I could not figure out how.
The error is caused by a null value being returned from AssetDatabase.LoadAssetAtPath() and Addressables attempts to use this null value without first checking if it is valid. But because of previous checks and code, I don’t know how it’s actually getting to that point at all; in my tests, it always errors out before this point.
please, can anyone help with accessing asset bundles?
do I use or not use Application.streamingAssetsPath in edit mode?
Ive followed now two different examples unity has provided for accessing asset bundles and neither work
An AssetBundle is content that is stored separately from a main game or application and loaded (or downloaded, in the case of mobile and online apps) at runtime. This helps minimize the impact on network and system resources by allowing customers to download and install only the parts they need. AssetBundles can also be used to update or add to ...
oh
the two different examples build the assest to different directories
but they both ask for the streaming assets folder when trying to load
how to build an adressable group without building the player?
so i can update parts of my game independently of each other?
?
Is there a reason AssetReference is not an IResourceLocation?
How do I call Addressables.LoadAssetsAsync with a list of AssetReferences?
According to https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/AddressableAssetsGettingStarted.html
You can make an asset addressable by:
Put the asset in a Project folder that's marked as Addressable
E.g.
However When I select a folder in the project window, it doesn't have any inspector. How do I actually mark a folder as addressable?
Sometimes it will appear in the inspector, but you’re right; it’s not reliable. You can drag the folder into the groups window though, and that should do the same thing
thanks
Oh! One issue though that I should mention: If you are using the Asset Database Play Mode script and you have an asset that is both marked as addressable and within a folder that is also addressable, there is a bug where the asset will be returned twice. I believe the bug affects LoadResourceLocationsAsyc() but I cannot remember if LoadAssetsAsync() is affected. I encountered this bug in 1.18.19
yikes. Ok thanks.
What's the major difference betwen LoadResourceLocation and LoadAsset btw
@low halo You can get resource locations without being locked to a specific type if you use LoadResourceLocationsAsync(). This was actually the cause of a bug in my case, because I did not expect it. It might be useful if used intentionally though. The manual also mentions using it if you need to create an association between the key and the asset that was loaded with that key, as LoadAssetsAsync() does not guarantee that the assets are loaded in the same order as the supplied keys. This is mentioned at Using Addressables at Runtime -> Loading Addressable assets -> Loading Multiple assets -> Correlating loaded assets to their keys
Besides that, I haven’t seen a difference between the two. I’ve been preferring to use LoadAssetsAsync() where possible to increase code readability.
Has anyone ever seen an issue where LoadAssetAsync never finishes? It doesn't get an error or anything, it just dies completely. The Nevermind I'm being stupid.completed event is simply never called.
I was trying to update some images in one of my addressables groups and it wasn't showing up in the window
so I unchecked the folder for "exteriorDoor" and checked addressables again for it, and suddenly the images showed up in the window
so I rebuilt the cache and now I'm getting InvalidKeyException
to make sure I didn't screw something up with the images, I unchecked/rechecked the "typeDoor" folder and also rebuilt the cache
and it too is now throwing InvalidKeyException
I'm not sure what I'm doing wrong but now I can't get the database to work the way it was before
yield return new WaitUntil(() => scrollpaneLoaded);```
I've tried purging the cache and rebuilding a couple of times, and each time it tells me the key is invalid, even though I can see it in the JSON, the folder, and in the Addressables Groups tab and there's no typo
aha I figured out the issue, I was using labels for those groups and resetting them erased the label
I didn't notice because the groups tab was small and the labels were hidden
🤦♂️
I just had my addressable groups disappear
Is there a way to bring them back?
oh nevermind
was being dumb
missed I had a search
is there a way to automatically add a preflix to addressable assets in a group?
its just that there is a lot of objects to rename with a preflix.
New to addressables, doing a tutorial, I am trying to get a reference to an instantiated object, but the value remains null
How do I get a reference to an addressable instantiated gameObject?
I had to add ".Result" even though it wasnt in the tutorial, because otherwise I cannot get a reference to the gameobject at all, but that didnt work so it must be wrong
Hmm, could it be because the tutorial is asking me to instantiate something without async loading it first? so when I try to save the object to a GameObject, there is nothing to save yet because it takes 1+ frames to load?
Hmm if I understand that doc, its saying .Result should return the game object, but my GameObject variable is null
but the game object does get instantiated into the scene so I know that part is working
i don't understand
Thing is null
but the object gets instantiated, I just don't get a reference to it
how do I make it not be null?
are you using a coroutine?
I'm not, the tutorial didnt ask for one
you of course have to wait for the operation to succeed. i don't know what tutorial you're using
maybe they don't use the async variant
The AsyncOperationHandle returned by InstantiateAsync() will not have a valid value in .Result until the AsyncOperationHandle completes, and it needs to complete successfully.
To be notified that an AsyncOperationHandle has completed, you can subscribe to its .Completed event. You can also yield return the handle inside a coroutine, which will yield until the operation completes. You can also poll .IsDone periodically in a location like Update(), but I recommend using a coroutine or an event listener instead as the code will be easier to work with. If you are comfortable with async/await, you can also await the handle’s .Task.
For further information, I recommend reading the Using Addressables at Runtime -> Operations section of the Addressables manual. It includes code examples.
is there a way to limit the scope of the assetreference when selecting in the inspector? say limit the scope of it on a specific group?
not that i'm aware
Hi, does anyone know of a good guide to making a webgl release that uses addressables to minimise loading times? I want to have everything for each scene download when that scene is loaded. I found some tutorials and understand the basics of addressables and Unity's Cloud Content Delivery, but I cannot find out how to get started on putting entire scenes in addressables without making a mess. Any help would be greatly appreciated :—)
when loading a scene it seems there's a slight hitch despite the function having an async suffix, is this normal?
slight hitch?
it's like the scene is being loaded not in async is what I'm saying.
the scene will be loaded async, but changing to the scene happens sync on the main thread, so there's a tiny drop
but the drop happens when I load the scene as additive though.
How do I unload specific addressable scenes? I followed this guide (https://learn.unity.com/tutorial/addressables-scene-loading) to load and unload a scene, but I can only unload the last scene with this. I want to have a loading scene load a scene and then unload the loading scene
If loading the scene creates and activates a lot of gameobjects at once, that will all happen synchronously after the data is loaded, which could easily be enough to cause a stutter. Creating some of the objects inactive and activating them later might help, or at worst you could split it into multiple scenes (but that has its own set of downsides).
Store a different AsyncOperationHandle<SceneInstance> for each scene, and call UnloadSceneAsync with the handle corresponding to the scene you want to unload.
Thank you. I don't understand how the original script turns the AssetReference scene into a SceneInstance.
LoadSceneAsyc is the call that loads the scene; the sample adds a callback function when that load is completed that stores the resulting handle in the handle member. To store it somewhere else you would probably just make a different callback.
So, if I understand correctly, I cannot unload an already loaded scene like that and I'll have to make a scene that has a script that controls the loading of all scenes?
I've managed to do it now by loading a scene and making a specific handle for it. Is there a way to create this handle for an already loaded scene?
I won't say it's impossible, but I don't know any ways to do so.
is there anyone who is bored and wouldnt mind helping out a young fellow unity user?
with what
Was the already loaded scene loaded through Addressables? Or was it loaded through SceneManager?
the thing is,
Loading the scene via buildSettings,
on a new scene with default stuff in it.
Doesn't stutter.
but on Addressables, it does
In this case it was the first scene to be loaded by loading the game
If I make all my scenes addressables, and upload them to the unity cdn, will that automatically put all the dependencies (gameobjects, materials, etc) in there too? Or do I have to put those into groups seperately?
Having issue getting {classname.staticString} to work as the local load folder when using external assetbundles
any ideas?
public class ModLoader : MonoBehaviour {
public static string LOAD_PATH= "Mods";
}
Unable to open archive file: ModLoader.LOAD_PATH/npc_test_assets_all.bundle
Any idea why it's not evaluating it?
You might need a little more context, as I've no idea what object this is even inspecting; there's no mention of an "Internal.LoadPath" property (that I can find) anywhere in the Addressables documentation.
Is there a way to avoid multiple built in shader bundles?
I have a client project trying to load 2 different catalogues and a model from each (each rely on builtin shaders).
The first loads fine but the second errors due to trying to read it's own copy of builtin shaders and there being a duplicate
I don't think there's any way to avoid having multiple, but there's an option in the addressables build settings to add a name prefix to the shader bundle so it doesn't conflict with others.
hmm, I changed the bundle name to include a hash at the end, but it still complains that the files inside are identical
Any idea what the right settting is?
If it is the first scene loaded, then it should have a build index of 0. You can call SceneManager.UnloadSceneAsync(0); to unload it; you shouldn’t need an Addressables handle.
Thank you @swift birch
wdymn by "doesn't work"? Is there a compile error? Runtime error?
hiii, if i have 2 scripts, one has a timer and a bool timergoing = true, and the other one has some other stuff, how can i make timergoing = false from the script with the other stuff:)<3
Is there a way to load unbundled content within Addressables if it's in the right format for unity to consume already?
Alternatively, is there a way to programmatically create bundles either without the editor, or while using the editor purely as a headless library?
Creating bundles using the editor as a headless standalone application should be doable; I'm not aware of any way to do it as a library, though.
Hmm- Can you extrapolate what you mean? I didn't know the editor could be launched headless
My goal is to use the asset build pipeline, but invoke it as a service of sorts; I want to produce addressable asset bundles and upload them to a CDN, upon request from services in our cluster which will specify something akin to the parameters of https://docs.unity3d.com/2022.1/Documentation/ScriptReference/BuildPipeline.BuildAssetBundles.html
You can use command line arguments to run the editor in batch mode and execute commands: https://docs.unity3d.com/Manual/EditorCommandLineArguments.html Though now that I think about it it's not truly headless, just noninteractive; it will still open and close the Editor window, which may not meet your needs.
that'd be sufficient, I think; thank you 🙂
it looks like I want -batchmode -nographics
does anyone know how to chanje the directory of an adressable file. the dream would be drag n' drop however i cant quite get it to work.
id assume the above would work however it does not
Nmod is the adressable file
here is what it looks like with its preset folder:
ah, ive seen it doeset work in diffrent folders at all
how would i fix somthin like this
so ive decided to take this a new rout and use Application.dataPath however i still get these errors when loading. any help?
---Nevermind---
so I was missing a subfolder in my load path. I still dislike that I cant just move an addressable to wherever I want tho.
Heads-up; there is (or was, as of a month or two ago) a bug where -nographics caused issues with building the asset bundles through Addressables. If I remember right, it would fail silently. If you run into issues, it may be worth removing -nographics to see if that resolves them.
Do I put scenes that I want to be downloaded separately into separate groups, or do groups not work in that way?
@fervent lintel you can put them in the same group and set the group's Bundle mode setting to Pack Separately
Thank you, will it pack all dependencies with the scene?
Yes. All dependencies that are not included as another addressable asset will get included in the scene’s bundle file as well.
Thank you, very helpful. If I've got assets that appear in multiple scenes, do I put them somewhere separately, so they don't have to be downloaded twice?
You can use the Analyze tools to check which assets would be added in as duplicates. This is the one 'fixable' rule. You can run that, and it will tell you (and can fix for you) which assets will be duplicated across bundles
It will put all duplicate assets into one single Addressables group. You can move them around to other groups afterwards if that makes more sense for your project structure
Alright, major thanks, I'll look into the Analyze tool
Will UnloadSceneAsync remove the scene from the cache, or not? I've found different sources claiming the opposite
Oh heck I didn't see this channel. Sorry, I posted this in advanced code by accident by I should've posted here lol.
#archived-code-advanced message
Is there any way to make a "dynamic" catalog where resources can be summoned by request in a particular address space?
Something like "all addresses within foo/bar/ may exist, if the cache hasn't already resolved it, ask this provider to check for its existence on-demand"
I have no idea about that, sorry :/
Hmm, no, Addressables doesn't really lend itself to that. It would in a resource managing/loading aspect of it, but not in the generation-aspect of user generated content. Especially not from within the game.
In theory I would think this is possible if your players downloaded the Unity editor and had access to (part of) the code and assets that they require to build their content, but something like this isn't possible from within the running game itself as a lot of tools for building are not available in the player.
I think something like that is possible using custom providers, but I have little to no experience in that.
I was under the impression that custom providers still required catalogs that resolved to a fixed set of contents
e.g. you can't ask for a resource and detect which catalog to try to load based on the address requested
Hmm, that's true. 'A' catalog is indeed required to be loaded. But I think it's up to the provider how it handles the catalog in terms of how to search for the requested address. Perhaps the catalog can be somewhat different than the default generated ones and provides your custom provider with hints as to what to load. But perhaps that's taking it too far already (and I'm just speculating of what I would investigate, but I can't say for sure something like that will work)
Ohhh, so you're suggesting there may be room to overload the catalog interface itself and use that to determine "if it contains an address"?
Yeah, something like that
I'm not sure I can tell which interface is appropriate for that; I'll have to dig deeper- but if anyone has any information on what might be the right interface to override, I'd be glad
makes sense thanks
I think IResourceLocator is the interface you're looking for? I haven't tried doing anything fancy with it myself, though, so I can't say for sure.
how can i change a float value for a x amount of seconds then it changes back
that's not really an addressables question- but you can use an async function and await Task.delay(x * 1000) between setting the variable and resetting it
use a coroutine, but yeah wrong channel
i'm noob addressable user
i need help if this problem below is a bug or if there is anything i missed
Question 1
AssetReference is null when "Use Existing Build"
- Scene, Prefab, Object are all added to Addressable group
- Clean, New Default builded
- It's working normally in fastest mode
- The problem is not reproduced in the sample example using Addressable 1.18.16 (same setting...)
this problem does not occur when playmode in that scene,
when loading the scene through LoadSceneAsync, all of the things binding to the
scene's AssetReference change to null
"Fastest" mode would not use the bundles, it would just serve it from the assetdatabase
are you sure the bundle is being built?
search your project/Library/ folder for *.bundle
in Library\com.unity.addressables\aa\Windows\StandaloneWindows64
Right below the Library folder, There is no *.bundle file.
yea, thats the right location for it though. is that the bundle you were expecting?
(did you define any other Packed groups?)
To simplify the problem, i currently have only Default Local Group, removing all groups.
Shall i make a new group?
I saw a ping. did you send something?
i think i found the cause of the problem
Perhaps the setting of the Discord channel erased the mention message immediately.
lol yes
(if its a big ol' script paste yea it'll nuke it)
editor only serialization will indeed go null if drawn from built stuff
Is this normal to happen when #if UNITY_EDITOR is used?
that compiler directive will hide that code anywhere except when using UNITY_EDITOR
so serialized variables wont serialize in a Build
that can have weird implications in an AssetBundle
Thank you for your kind answer. It was helpful. 🙂
👍
I have a problem when loading scene with LoadSceneAsync (additive, activeOnLoad true)
when i load scene with LoadSceneAsync
and Scene was set to be active with SetActiveScene,
lighting of SceneView looks abnormal, but GameView looks normal.
There is no such problem if i load the Scene by SceneManager.LoadScene (not addressable) way
The hierarchy item is also different when using SceneManager.LoadScene and Addressable LoadSceneAsync
which part should i check?
I solved the problem.
The problem was the always refresh option for the scene editor .
So, I'm experimenting with Addressables.LoadSceneAsync / UnloadSceneAsync.. and it seems like it's failing to clean up memory properly (textures and meshes), causing a memory leak. I found a couple of old threads about it, but seems this has not been fixed yet?
Fresh project, using the urp sample scene to experiment with.. Getting these results:
The prefabs i have marked as addressable show pink on every texture when in playmode on android in editor. if i run a build the textures are fine. this has become a problem because its made debuging very hard
help? ❤️
I just stumbled onto this asset...why doesn't Addressables handle LOD's out of the box?
https://assetstore.unity.com/packages/tools/camera/addressable-lod-group-195930
I have rooms that are addressables.
rooms have doors, but the doors are children of the room, and cannot be addressable themselves.
How do I reference a specific door within a room after loading the room addressable itself?
Ive tried googling it but I cant find any example of targeting a child of an addressable
Is there a way to reference the child of an addressable?
drew a diagram to make it easier to understand
Hmmm I don’t know of a way to reference a specific child object of a prefab like that. I would solve this by giving each door an ID of some kind, and then have a way to get the door object from its ID once the prefab is instantiated
How would you recommend I try setting an ID? My "Rooms" do have a list of every Door (Transition) on the root object, but I wasn't able to figure out a way to use this list to connect between doors
Going to the Room is the easy parts, Doors have AssetReferences to the addressable Room, but afterwards I am not sure what kind of data type will allow me to target the doors within the room
You could create a serialized class that represents the door, and contains its Transform reference and an int field that stores its ID. Then store a list of these serialized classes instead of the Transforms.
Alternatively, you could create a MonoBehaviour that stores an int field for the ID, and add that to each door. Then store a list of these components instead of Transform or use GetComponent.
In your example, Room C’s Door 1 would know that the ID of the door it needs to connect to is, for example, 2 (making door IDs the same as their number for simplicity). Once Room A is instantiated, you can ask Room A’s door manager for the door with ID 2.
Update: Sorry, I just realized that you said “Transition” here, not “Transform”. Hopefully the rest of the advice is still helpful
Reading this all now 👍
Doors are "Transitions" so I have a serialized class. I'll give it an int for ID like you suggest.
A thought I just had: You could create an empty ScriptableObject and create assets of it for each door in your game, and then use reference to that asset instead of an int ID. That way you don’t have to remember which numbers go to which doors while designing rooms. Room C’s Door 2 and Room A’s Door 1 would both use the same ScriptableObject asset as their ID. Normal advice for working with ScriptableObjects and Addressables applies regarding dependencies and accidental duplication.
Hmm, would that work if for example, Doors A + B + C all went to Door D, but D only returned to one of them?
Doors wont explicitly return the way they came is my thought, Door D might not even go to A B or C in that example
You could create separate instances of the ScriptableObject for each unique case. Having a name and being able to use Unity’s asset system to rename these door connections is probably the major benefit
Small note on ScriptableObjects + addressables - the ones in a build will not be deserialized as the same Unity Object as ones from addressables. So, if you have a class in your main app that references SOs (e.g. a 'door mapping' monobehaviour) - they won't reference the same objects as the ones that are deserialized in your door prefabs.
Are you saying that a SO variable in a monobehaviour, doing like an IF == comparison to the same SO but instantiated from an Addressable wont return true?
correct
Good to know, that would definitely have tripped me up 👀
yea.. not intuitive at all
I have a custom inspector that I need to load an addressable to get some information from it in the project, is that a bad practice?
Loading addressables in Editor while the game is not even running I mean?
X/Y question maybe, hold on
How do I get the prefab an addressable refers to for use in a CustomEditor Inspector?
its an AssetReference currently
In this example Asset is null because I wasn't loading the Addressable before trying to access it
my addressable is always null it seems, Im guessing you just cant load addressables from editor scripts when the game isnt running?
"Addressbles just isn't set up for editor loading (outside of play mode)"
Well this is a bit of a problem for me
I need info about the prefab the addressable is addressing in editor, and the only reference to it I have is that addressable
public static T LoadInEditor<T>(this AssetReference assetReference) where T : UnityEngine.Object
{
var path = AssetDatabase.GUIDToAssetPath(assetReference.RuntimeKey.ToString());
return AssetDatabase.LoadAssetAtPath<T>(path);
}
Found this online, might be the solution I need
My AddressableReference returns "[]null" and this gets past my null test
What is a []null and how do I check for it and stop it?
I thought it was maybe a string because its in quotes, but no dice
noob question...
I understand that 'group' is a unit that is grouped into real files, and 'label' is a unit to find items like tags.
Honestly, this concept doesn't really touch me.
I'm curious about the exact use and difference of group and label.
q1) I want to know when to choose and what to spend.
q2) What does it mean to check "folder" as addressable?
(How sub-folder items are handled, when they are used)
Groups and labels are really separate concepts, used in different ways.
Groups are mainly used for the build process and how/where the player will load them from, like physically.
Labels are a runtime only concept of what assets you want to load.
A group contains the assets how you structure them and what makes sense for your project. If you have a sword asset with several skins for it, you can group those in a single group, and armor with different skins in a different one, or group all equipment together in a single group. Whatever you choose and how you want the Unity player to load them in (you can customise several settings on a per-group level). If you have assets that need to be available immediately, for example, like several UI or manager objects, then keep them local. If you have end-game levels or monsters, then you can put them in a group that will be downloaded from an external source later and save some disk space for players that haven't reached this end-game content yet. The concept of a group does not exist anymore during runtime, because Addressables doesn't care anymore at that point.
A label determines which asset(s) you want to load at runtime. If you have multiple assets with the same label spread over several physical locations, it will try to (download and) load in those assets (of which it knows about through the catalog file created during build), regardless of how they were grouped.
Does anyone know what I'm maybe doing wrong? I'm using one scene that handles the loading of scenes with addressables; it loads a scene, unloads the previous scene, etc. All works perfectly fine, except for the lighting options. When I open my scene directly in the editor and play it, there is no fog, when I load it through my scene handling scene, there is suddenly a fog. The scene handling scene has no fog, but the unloaded scene did. Is it not unloading the lighting settings?
Edit: It's actually making the light less intense, rather than doing anything with the fog
How to make sure addressables load on game release? Game runs perfectly in editor mode, but when I compile the release, some addressables (textures) won't load at all.
Is there some catch that I didn't know?
After I finish preloading an addressable, what is the syntax to then instantiate it?
public static void PreloadTransition(AssetReference room)
{
Addressables.LoadAssetAsync<GameObject>(room).Completed += ObjectLoadComplete;
}
private static void ObjectLoadComplete(AsyncOperationHandle<GameObject> obj)
{
if (obj.Status == AsyncOperationStatus.Succeeded)
{
//Instantiate happens here.
}
}```
Would I use the regular Object.Instantiate in this context?
It's now tomorrow and I find myself needing to make that exact check. 💦
I got instantiation from addressable working, but now I need to make sure I dont instantiate a room that already exists
someone online suggests a dictionary of assetreference, gameobjects. Ill try that
The net says absolutely DO NOT use Object.Instantiate, but it doesnt say what I SHOULD use in its place
Yea I usually have an SO with a serialised array of all the SOs and then find them by unique id. Ended up doing it quite a few times. Didn’t comment to pimp my own asset but in case you think you’d find it useful the asset’s called BTagged. Only really takes care of the unique id part - you’d still need to the dictionary part and it sounds like you’ve already got that covered.
We use just Object.Instantiate to instantiate Addressable assets. It's just that the automatic unloading mechanism won't know about it, and you'll have to release manually when you know you're done. It's not wrong to use it, it's just a bit more work to keep track of what you're doing.
In our case, we had a big project already which we were switching over to Addressables, and we already kept track of what was loaded in, so we kept doing it, since this approach translated really well to Addressables.
They would recommend you use Addressables.InstantiateAsync. Though as Jan says, Object.Instantiate is fine if you know what you're doing and are careful about it.
I've been working Addressables into my game and I got it working stable in editor. I did a build to test it and I got this error in build but not in editor.
I'm not 100% sure what it's saying but it looks like its saying it failed to load the addressable?
This is the first build I've built with addressables so I assume I must have missed a initialization step when you add addressables to the project maybe?
Do addressables need to be in a special folder like how Assets/Resources do?
I found a link online but I cannot find this "addressables" menu with mode selection. I went through Window>Asset Management> all the addressable window options, but none of them were just flat 'Addressables'
hmm the net says "Window > Asset Management > Addressables) "
Im guessing the online resources are out of date? because that isnt a window that can be opened on latest unity
I keep finding reference to an "addressables" window but I dont seem to have that window
I found this but Im struggling to parse what im supposed to do from it
I've read this block 4-5 times but my brain cant seem to grasp what Im supposed to do to get this in my project happening
I dont mind it taking longer to make builds, but how do I actually make it do that?
I guess my question at the end of all this is:
How do I make it build automatically when I make a normal unity build? I cant find a straight answer online that says "do X"
my asset settings seems to be missing some data compared to the doccumentation?
As far as I know I am on latest
It looks like the setting I need is under "Build" but I don have build 
hmm
im NOT on latest
im on 1.16.9
but there is no option to update
Im not the only one with this problem it seems
the changelog on addressables says there are tons of stable not preview releases after what I am on so I am not sure why I can't update?
I found out how to update to latest
but the option -still- isnt there
there is supposed to be a check box for "build addressables content on player build"
unity never makes things easy
How do I build my addressables automatically when I make a player build?
I feel like I am taking crazy pills
same version, same setting object, completely different settings to what the doccumentation says should exist
oh im on 2020 thats why I cant find it :|
"Building Addressables on Player Build requires Unity 2021.2+. In earlier versions of Unity, you must build your Addressables content as a separate step."
now I have to figure out how to do this "separate step" automatically when I make a build
woo okay I am in buisness, found a script online that does it
I am getting a big lag spike in Build and in Editor when I run Addressables.InstantiateAsync(room).Completed += loadComplete =>
I have never used the Profiler before so I am not sure what its telling me to tell what is causing the lag spike however. It appears its related to physics callbacks maybe?
hmm if im reading this right, InstantiateAsync isn't being async, its sitting and waiting for it to finish loading?
which is what I feared is happening
I get a huge lag spike when I call LoadAssetAsync, I am not even instantiating it, just loading it alone, In Build (but also in editor)
https://cdn.discordapp.com/attachments/856296882628591667/931967034521178182/unknown.png
Im convinced its not the asset itself that is causing the lag, because I get the same lag spike even when I run "LoadAssetAsync" on a blank empty Game Object, just a single gameobject prefab, no components or anything else on it, not even instantiating it
hmm even this causes a big lag spike at 5s
I think I solved it
there is a large lag spike associated with running LoadAssetAsync for the first time
if I run it, loading a blank prefab, at start, all subsequence calls of that method cause no lag spike, regardless of the size of the thing being loaded
Doing that made it work, I solved it in the end, no lag anymore
I have a dictionary of my instantiated addressable rooms, I am using AssetReferences as keys, and the instantiated room as values
but for some reason, 50% of the time when I pass in the AssetReference, it returns null
when it sees null room, it assumes the room has not been spawned, spawns a new room, and then logs it with the AssetReference/Spawned room
when I debug log the contents of the dictionary, I can see there are multiple of the same room spawned, and using the same identical AssetReference key
I can't figure out why it returns a null when logging shows the same identical AssetReference Key saying there IS a room to return
I say 50% of the time because I use this code in two places, and I dont know why but identical asset references as key, the same copied value, will return the room in one place, but wont return the room in the other place, and I cant figure out why
when I debug log an AssetReference, this is what I get
but when I thing == thing them, they are not returning as equivalent
for now, I am doing AssetReference.ToString(), because that DOES return as equivalent
are there unforeseen circumstances to this solution/action?
Hmm
My ToString sollution didnt work
it worked sometimes, but after further testing, the strings dont always align
I need some way to pair up asset references with instantiated objects in a dictionary that is no fail
thus far every attempt hasnt worked
Okay I have no idea whats going on, because now I cant reproduce the dictionary not returning
is addressable normally take that long? sorry, first time I use this package
restart unity
I have restart twice
I mark this folder and dotween folder, then press build in addressable window
im trying to simulate my game on my phone, i have already built it and opened it in xcode but when i try to pick a simulator it gived me no options:
Hey guys, how come this "Completed" in Editor fast but takes forever in WebGL build?
Debug.Log("Start Initializing");
Addressables.InitializeAsync().Completed += (handle) => {
Debug.Log("Initialization " + handle.Status);
initialized = true;
};
}```
I believe the default behaviour on WebGL is to download the bundle from a server. Main thread (a.k.a the only thread) is likely a lot busier on WebGL too.
Also make sure to actually use the addressable bundle in editor to have closer behaviour to build, as editor has several modes for using them
Thanks for response! So I am currently using ngrok to serve my WebGL file for testing and as soon as I switch to GitHub pages the issue goes away and it Completes the initialization almost instantly...
Browser networking tools can help to show what is going on
Be mindful of browser caching too
I use Chrome, any ideas what to look in?
Well you can watch stuff load live in the networking tab, which would give some indication of download speed
Also shows caching status
I’ll try thanks…
So how do I know which file to look at for the Addressables.InitializeAsync?
Is this it?
Settings and catalog are more informational. Big files after them are likely your bundles.
Yeah but I'm not loading the bundles yet, just trying to Initialize Addressables first...I was having the delay issue with just downloading the catalog instead of initializing so that's why I thought maybe I should initialize first then download later so it could be faster. With this test I realize the downloading wasn't actually what was causing the issues (the catalog files are tiny as heck probably less than 1 mb so that couldn't be the issue I thought)...
Oh I see, yea that's quite odd
How do I find an AssetReference through code?
I have an addressable I need to spawn but I don't know in advance what it is, I need to find it at the moment of
How do I assign to this field from code?
my failed attempts to do so
editing SerializedProperty directly failed, editing with set dirty failed
this also didnt work
im really struggling here
I need to use addressables to load a room on start up
but I dont have an asset reference to that room
I have a regular old game object reference, which I need to convert into an asset reference, or store the asset reference to itself in the game object of itself
and I want to do this all through code, not inspector
If you have a regular old GameObject reference why do you need the asset reference?
I dont know how to instantiate addressable from a game object, only from an asset reference
Can't you just instantiate the GameObject directly if you already have a ref to it?
If I do that, it wont be instantiated with an asset reference and then I wont be able to release it later wont I?
the addressables doccumentation says not to use Object.Instantiate
I'm just failing to see how addressables are involved at all in this case
My rooms are addressable prefabs. I want to instantiate my addressable as an addressable, with the ability to release it later
I have reference to the prefab but I dont know how to get the addressable reference to the prefab in the project
<@&502880774467354641> found an issue with addressable 1.19.17 - and 1.19.19 -> when used instantiate Asset from Project inside the Script of the Addressable Asset ( Addressable Prefab with custom script) -> after first release of this Addressable Asset -> Secondary instantiations of the Addressable Asset Prefab and instantiating Asset Prefab from Project -> causes the Asset Prefab from Project to lose TMP font material as well as custom sprite/textures on the UI. What should I do?
You could start by not pinging the admins 🤦
As with any bug, report it through the editor. This discord isn't an official communication line to Unity.
Not sure where to start with this:
I have an APK submitted to Google Play. In their testing it is reported to have API warnings:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
at java.lang.Class.getDeclaredConstructorInternal(Native Method)
at java.lang.Class.getConstructor0(Class.java:2325)
at java.lang.Class.getDeclaredConstructor(Class.java:2166)
at bitter.jnibridge.JNIBridge$a.<init>(Unknown Source:25)
at bitter.jnibridge.JNIBridge.newInterfaceProxy(Unknown Source:8)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
at android.os.MessageQueue.next(MessageQueue.java:395)
at android.os.Looper.loop(Looper.java:160)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
My question asking for a hint as to where to start looking at this or reproducing it. I am guessing Android studio is the environment? TIA.
The next report shows Landroid/media/AudioSystem;->getPrimaryOutputFrameCount()I
I am thinking an audio asset is at fault. My app doesnt have any audio in it but there could be a disregarded/unaddressed listener on some game object.
Solved the issue, Addressables doesn't work properly when using ngrok as server...
With addressables and assetbundles, I am trying to put in for example terrains, most of the assetbundles im using atm work fine, but when i tell it to load a terrain for example from assetbundle, I dont get any errors, and in inspector shows it loaded it, but the rotation is way off, and its not showing in the scene
shows the terrain file is attached, and everything is on, but the terrain prefab its loading has 0 pos and rot when loaded as a bundle it gets weird rotations and isnt visible, if i click the terrain paint aspect shows the terrain layers and stuff
Is there any way to split asset bundles into multiple catalogs. I want some bundles to be in the install folder, and other bundles to be in a different folder. Is the only way to do this to have two different profiles that build some of the bundles each
Can someone tell me why I have issues with my URP shader built with ShaderGraph? It doesn't work when instantiated with Addressables...
It looks like this:
Vs what its supposed to look like:
So the effect is blank in the first picture...what could the issue be?
hello. is there a way to change the load path at runtime after initialize?
I've seen it mentioned on the forums somewhere
Nvm, there was no issue. It was my fault cause I had 2 similar objects and the main one was disabled through code and I forgot...ugh..
Is it possible to generate one set of addressables that can support multiple platforms? I.e. I'm building for WebGL, Android, iOS & Windows. I have to execute the addressable build 4 times to support them all.
(This is part of a daily dynamic build that changes content and takes about 3 hours to complete)
had 3d addressable objects in a project and it vanished from my hub when i open there is nothing there only the sample Scene . is this possible?
I think I will go back to build binary save and loading system by myself until all the addressable thing will be more simple and reliable.
UnauthorizedAccessException: Access to the path is denied.
What the hell is this, where does it come from, how can one get rid of it?
Comes up randomly and I really can't get my head around it. Freshly built asset groups. nothing weird happening on build pre/post process
But I couldn't find anything about this error anywhere on the internet :/
you don't have permission on this path. how to fix: run as admin
It comes up randomly
sometimes it works, sometimes I get that error
it has nothing to do with running as admin
anyone know why the wheels going through the ground but stopping at the box collider of the car?
fixed it
i didnt fix it i just made the box collider of the car bigger but it did the trick
I'm trying to get some insight on what would the correct pattern would be for an Items system. Starting with an enum of ItemIds, each item prefab holds one of these ids, the way I see it right now I have two options either:
1 - Make sure the address is something like "Items/[itemId]" and when I need an item, do a LoadAssetAsync. Which seems weird and kind of prone to error, having to make sure the strings match both in the enum definition and in the address.
**2 - **Loading all addresses with the "Item" label on startup, and mapping them to a Dictionary<ItemId, AssetReference>, which seems a bit overkill maybe? And is a whole process on boot?
Maybe I'm overthinking it, or there is even a completely different approach I'm not seeing. In any case, I would appreciate any insight on this
Is this issue connected to the adressables ?
01-27 23:40:16.089 31919 32137 E Unity : MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[[UnityEngine.GameObject, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
01-27 23:40:16.089 31919 32137 E Unity : at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
01-27 23:40:16.089 31919 32137 E Unity : at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
01-27 23:40:16.089 31919 32137 E Unity : at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00000] in <00000000000000000000000000000000>:0
01-27 23:40:16.089 31919 32137 E Unity : at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, System.Int32 operationHash, System.Action`1[T] onDestroyAction) [0x00000] in <00000000000000000000000000000000>:0
01-27 23:40:16.089 31919 32137 E Unity : at UnityEngine.ResourceManagement.ResourceManager.CreateCompletedOperation[TObject] (TObject result, System.Boolean success, System.
I am very new to addressables, but would like to understand how I can use addressables to solve adding custom animations into my game after release. Something like what Fortnite did, I need to find a way to add more custom animation into the main character's animator controller, and access them via code without knowing what those animations are.
Are there any working examples of this in action I can review?
I am currently using asset bundle to load the animation and other custom clips, but would like to give addressables a try.
I used this to get started: https://gamedev-resources.com/load-unload-and-change-assets-at-runtime-with-addressables/
Addressables are considered "the right" way to manage assets within your game and helps tremendously with memory allocation. Get an overview of what the Addressable system is, the benefits in using it while learning how to dynamically load/unload an addressable by instantiating a prefab and changing a texture reference.
For the animations, I would retrofit the Texture loading section of the tutorial for animations instead...
Thanks! I'm researching on another problem regarding of Unity's animator and how I could load custom animations at runtime. It seems like I'll have to use a plugin called animancer to resolve that.
I don't know what that is sorry...
All good. I'll read the article you sent me. Thanks!
Now for people more adept at Addressables than I am can someone give me the basic anatomy of the files I need when loading from a remote server? The problem is I don't know what files I need to delete from remote server and what to keep when I make changes to the Addressables group. When to build the whole project again vs when to not to (and just build the Addressables group instead)...any help?
These are the files I have:
The craftastechlogo_assets bundle file I know is what gets updated with catalog but what is the "faad2dab2f6d33164579cd0" bundle file?...
And what are the catalog files there?
you can use catalogs to browse the menu and order whatever you want
either upload it on server or cache and reuse is fine
So I don’t need to upload the new catalogs at all only the bundles?
if catalog changes then you need to upload it
it is used to access the files
if it's not on the catalog, you can't access it
What do you mean changes? New stuff added to addressable groups?
oh, you're referring to this.
you don't have to upload it, but you don't have to upload anything either 😛
what I meant is that you could ship it together with the build if you want to
... I think
also I'm not more adept at all.. if you happen to have figured out an answer for my question at #archived-code-general please let me know 😛
Me am confused? How does that help when I change stuff?
there should be a 'build content' and a 'update content' option
use the 'update content' when you're updating content
also, ignore everything I told you about the catalog.. just upload it too
Hello. I'm fairly new to addressables and wanted to ask what is the best way to separate catalogs that are in the dev environment vs production.
I understand that if I build my project with a certain Profile selected, that build can only load assets from one RemoteLoadPath (hosted on a CDN).
So if I wanted to make a dev build to hand over to my beta testers, I would have to build my game using a different profile that has a different RemoteLoadPath. Is this the best way to separate dev catalogs/bundles and production ones?
Update: I found a section of the documentation that answers my question: https://docs.unity3d.com/Packages/com.unity.addressables@1.18/manual/BuildingContent.html
My point is, do I need to update all those files to the server?
yes :p
you can use Addressables.ResourceManager.InternalIdTransformFunc to replace the server path with the local path
and use the same catalog, if you wish
So I'm basically replacing all the files then. So process is upload new files, then delete old files?
that's what I'm doing
(actually it isn't but you didn't seem to like what I said about the catalog files xD)
What did I not like?
I just need to know the proper process...
What files never (?) get reuploaded vs what files that do...
Sounds like a trick question, what do you mean access?
Yes, I've been using it in my tests after I build the project...
cool, then how do you do it?
I see
what if you didn't use AssetReference?
you know how you could access it?
I currently store my prefab in the Asset Reference variable from the inspector...
alright
I don't know any other way...
so, the AssetReferences come from the catalog
so you could have the catalog contained in the built (resources folder or w/e), so no need to upload it
now.. the catalog links the AssetReference to an asset, when you first 'load' it (be it either Addressables.Instantiate or Addressables.Load())
the link usually points to a server (or a local path, depending on your addressable build settings)
so, you don't really need to upload anything to a server..
now if you DO want to use a server, you can either upload the catalog or don't
-- based on if you prefer to have your catalog included in the build, or accessed via your server
the '.bundle' files need to be re-uploaded regardless
NOTE: not ALL .bundle files will need to be re-uploaded each time you 'Update content' (since the catalog contains the same links)
but to be safe, you can just upload and replace everything
NOTE: if you DON'T Update content, but REBUILD instead, your AssetReferences will be lost, so you'll need to both update them and your server files
@marble bay makes sense?
So after I build my addressable group, never rebuild? Just update?
optimally, yeah
Doesn't Unity automatically build the addressables groupd when I build my project again?
We need to pin your posts up top for this thread lol, i need to come back to it!
I'll ping one of the mods to do it once someone confirms it's correct info lol 😄
not 100% sure about AssetReferences being lost since I don't use them, just read something of the sort and been avoiding them since 😛
Thanks though!
So with the catalogs, I am not planning to leave anything with the build (cause I am watching the size of the build which needs to be as small as possible with WebGL), so just upload to the server (I am using Unity Cloud Content)...
I'm trying to get some insight on what would the correct pattern would be for an Items system. Starting with an enum of ItemIds, each item prefab holds one of these ids, the way I see it right now I have two options either:
1 - Make sure the address is something like "Items/[itemId]" and when I need an item, do a LoadAssetAsync. Which seems weird and kind of prone to error, having to make sure the strings match both in the enum definition and in the address.
2 - Loading all addresses with the "Item" label on startup, and mapping them to a Dictionary<ItemId, AssetReference>, which seems a bit overkill maybe? And is a whole process on boot?
Maybe I'm overthinking it, or there is even a completely different approach I'm not seeing. In any case, I would appreciate any insight on this (edited)
Just to be clear here.. because these terms aren't used in Unity.
By Update content you mean.. Update a Previous Build ? (which is rebuilding)
and by Rebuild you mean New Build -> whatever option? (which is creating a new build, not "re" building)
probably got definitions from older package version
Righto, just making sure I've not missed another way to update the catalogue
Sometimes you have to do a new build of the addressables. I updated the version of Unity for the project, and doing an update catalogue build wasn't enough, had to do a new build. So that users who hadn't updated the app wouldn't get a broken app, I did a new build into a different folder
Original: /ServerData/Android
New: /ServerData/Android_2022325
And have both on the S3 server
This makes sense, but do you ever get to the point of forcing your players to update?
In terms of how I am using it, its a web app so no downloading, you would load the latest version when you boot up page. Now I am questioning how to remove the old version and what happens if we do when player is in the midst of using the program? Or is that why companies do server maintenance times?
That, I'm unsure about, I haven't touched addressables in WebGL.
I THINK it wouldn't matter for a user who's already playing when you update.. unless/ until they get to a section that requires a download from the addressables that they haven't already gotten yet
Depends when you get the addressables, and if there's any refreshing during gameplay
Nah, they load the addressable from the beginning...
Guess it never hurts to test myself...
I don't think current sessions would be affected since they would still have the old catalogue, right? Probably do wanna keep the previous bundles around for a bit
If you expect extended session times and rapid update cycles, maybe a smarter setup needs to be implemented
Probably just gonna roll with keeping 2 different catalogs up at a time (oldest and newest) which gets replaced with each new catalog change...
But is the system smart enough to load the latest catalog?
Or do I have to manually do something here?
For anyone who is using the Localization package, what is the best practice for structuring the asset files. I notice that when I create a string table, it puts all the assets in one directory (that you choose) and its flat. Is it possible to move around the assets so it follows a locale language per directory with the table reference in the root or something?
You'd have to keep swapping between the two addressable profiles
and doing so, requires a new game build
You might be able to get around that by having a json (separate to the addressables) that has a version number + which URL to use. Check this on game load, get the latest URL, and pass that to the addressable system
Explain "swapping"?
setting the string url as pathA or pathB
How does one remove a localization string table used by the localization package? They don't have any documentation on how to remove localization tables/assets the right way. I don't want to manually have to remove stuff in the file system.
long downloadSize = Addressables.GetDownloadSizeAsync("LabelTest").WaitForCompletion();
doesn't work in Awake() on 2nd or later android app launches (when the asset bundle is already downloaded from remote) - any idea how to fix?
thank you for this old post - it just saved me
Hi all, in 1.19.17 I'm getting stack overflow on AssetReferenceDrawerUtilities, it's caused by using F-Bound polymorphism to construct a scriptable object that is an addressable.
Something like this:
public abstract class AddressableObject<TContainer> : ScriptableObject
where TContainer : AddressableObject<TContainer>
Function causing the issue:
private static Type GetGenericType(Type t)
{
if (t == null)
return null;
while (t.GenericTypeArguments.Length > 0)
t = t.GenericTypeArguments[0];
if (t.BaseType != null && t.BaseType.GenericTypeArguments.Length == 1)
t = GetGenericType(t.BaseType);
if (t.HasElementType)
t = GetGenericType(t.GetElementType());
return t;
}
Is this something known?
Is there a way to get the asset from an AssetReferenceT<Sprite> in an editor window? I've tried AssetReference.editorAsset but its null
Hey, new to addressables and assetgroups, I have a quick question. If I were to mark a scene in my project as "addressable", and none of the meshes/textures/sound files/etc. in that scene were referenced elsewhere in that project, would all of the asset grouping for those subassets be 'automatically' handled? Or do I need to maintain explicitly-dictated assetgroups of individual assets separate from that?
It is assumed that the scenes objects will also get packed but what do I know lol, I just test to make sure it works. Currently all I am doing is referencing prefabs (using AssetReference) and it seems to be packing the dependencies with it...although I did run into an issue where I had to pack material, shadergraph and texture to get something to show up, so idk...
I have a question. Why can't I drag and drop bulk items into a list of AssetReferences like I can with GameObjects and Audiclips? https://youtu.be/-HBXztlxR7k
Rules violated:
-
consistency: If lists for everything else in Unity allow bulk importing, so should addressables.
-
Time violation: Should be done in seconds, not minutes or hours
-
Focus lost: Drag and drop loses focus
-
Frustration: knowing you're losing time due to lack of consistency is annoying.
Am I doing things wrong? Or did Unit...
Does anyone in here know a good tutorial on how to build and use Addressables without it making Asset Bundles? I'm trying to find a good workflow while iterating on assets, and finding info on this particular part of Addressables seems really difficult.
So no one knows how to do traditional group populating of lists of addressables? Then it is a bug on Unity.
Is there some unique string, int, GUID I can use to reference addressables at runtime?
Hi everyone, I currently finding a way to load my assets remote, because of the limit of the google store (150mb), I think addressable is a good way, so my question is, I can make my assets (textures under Resources folder) as addressable assets and then in the app download the assets, and I can still use "Resources.load" to load my assets as usual?
That's a problem with asssetReference type when they are a list
This isn't really a problem with addressables. If you're ever in a situation where you have one object loaded and 98 from the same bundled unloaded, your asset bundles are set up wrong. With addressables it's pretty straightforward to set things in discrete bundles.
Also, addressables are asset bundles. It isn't either/or. And you should never use Resources.
Hi, I'm looking for a cloud solution to store Addressables remotely, and i'd like to know if someone uses DigitalOcean solution or AWS to do this, and if so, what do you think about it ?
I started to work on upgrading my project to use Addressables. I was using Addressables thanks to Localization package before.
I'm trying to do it correctly, that's why I'm using Addressables Event Viewer. It's very messy though, because of multiple "GetTableEntryOperation" that are caused by LocalizeStringEvent. I don't know why some of them get unloaded when destroying gameobject, but some of them stay in memory even when I remove whole prefab or switch the scene. Should I somehow release it from memory by myself?
Hi, I'm using Addressable to load assets from cloud, when I call API Addressables.CheckForCatalogUpdates, always return result is 0.
How to use Addressables.CheckForCatalogUpdates correctly?.
Thanks!
Ref: https://forum.unity.com/threads/how-to-fetch-latest-catalog-and-re-initialize-addressables-in-runtime.544125/
I am getting a weird bug with Addressable that I'm having trouble nailing down the source of.
In a pc Build, not in Editor, I am using a render texture as part of a visual effect. The Render Texture is populated from a camera.
If I drag a prefab into the scene, the render texture works as expected, however if I instantiate that same prefab through an AssetReference, the render texture returns black
I've carefully compared every single thing within the Addressable instantiated room vs. dragging it in manually, and I can't find a single difference between the two that could answer why the render texture is black in any of the addressable prefabs
Is it possible that something is being done to the sprite renderer that is in the scene at launch that isn't being done to the sprite renderer when the addressables instantiates the prefab?
Should we handle caching for addressable assets ourselves?
I mean if we do not handle it, they are downloaded completely every time?
public IEnumerator Start()
{
string key = "assetKey";
//Clear all cached AssetBundles
// WARNING: This will cause all asset bundles to be re-downloaded at startup every time and should not be used in a production game
// Addressables.ClearDependencyCacheAsync(key);
//Check the download size
AsyncOperationHandle<long> getDownloadSize = Addressables.GetDownloadSizeAsync(key);
yield return getDownloadSize;
//If the download size is greater than 0, download all the dependencies.
if (getDownloadSize.Result > 0)
{
AsyncOperationHandle downloadDependencies = Addressables.DownloadDependenciesAsync(key);
yield return downloadDependencies;
}
//...
}
No - cache is handled for you.
Thanks. Another but related question.
Does the code below work for addressable localization assets?
I have several addressable localization assets for each locale/language and I would like to download them individually
LocalizationSettings.StringDatabase.GetTableAsync(_tableRef, locale);
I' using Photon Fusion and now I'm trying to implement Addressables. When I initialize my MP game I load my chapter prefab, if player is a host (or plays single player mode) I have to spawn networked prefab in Completed callback, just like this:
{
Debug.Log ("Spawn for host and single");
roomHandle = Addressables.LoadAssetAsync<GameObject> (string.Format ("Room_Chapter{0}", chapterId));
if ((Runner.GameMode == GameMode.Host || Runner.GameMode == GameMode.Single) && Object.HasStateAuthority)
{
roomHandle.Completed += loadedRoom => SpawnChapter (loadedRoom.Result);
}
}
private void SpawnChapter (GameObject room)
{
Debug.Log ("Spawn Chapter");
Runner.Spawn (room.GetComponent<NetworkObject> ());
}```
What is weird, that first debug in InitializeGame gets called once, but the one in SpawnChapter is called twice. What can be the reasone that Completed gets invoked twice? Guys from Fusion say that it's not on their side.
Hello im really new to addresables, any tutorial for starting ?
^These aren't the same and so far as I've found there's no way except a long clumsy switch statement
Hi, is there anyone that can helpme out with addresables?
Im trying to use "DownloadDependenciesAsync"
But cant get it to work
IGot it Working!, but now I am ruuning in to this: How can I check if a certain AddresableAsset has been previously loaded, has a pending update or is missing and wiling to load?
Does anyone know why the Addressables tick doesn't show up on my ScriptableObjects?
I have the latest verified package version installed in the latest LTS version of unity.
It does show up on Prefabs
Package version
Unity version 2020.3.30f1
In case it matters, the PreloadSettings ScriptableObject is in a different assembly definition, but said ASMDEF does reference Addressables.
is it an editor-only SO
It's not, but it does not have a [CreateAssetMenu] attribute.
hrm, what does the assmdef look like?
Hmm, how about that, it says No asset usages in the IDE.
That does reference UnityEditor.UI, but that's all stripped out at runtime using #if UNITY_EDITOR
I've never done that before, but I'll take your word for it. Have you tried restarting Unity? Maybe it just needs a kick to get addressables to notice the type
Nope that didn't fix it, unfortunately.
I guess I'll try separating the code into separate assemblies for the runtime and editor. Bit of a pain but oh well.
Can you drag it into the addressables groups window?
How about that... I can't open that menu
Even after switching to a preview version it doesn't show up, odd...
I'll have to look further into that.
The answer is I'm and idiot and you were right.
I placed it inside an Editor folder for some reason, so it was an editor-only SO Instance.
I thought that only was the case for the script compilation but turns out it doesn't.
Oh, the SO itself was in an editor folder?
The instance yeah, not the script.
Interesting. Glad you figured it out
Thanks for the help!
Still no Groups window though, but that's not too much of an issue rn for me.
That's annoying, the groups window is pretty important imo
So the doc says InstantiateAsyc "This cannot be used a second time until the first load is released". But in the example of addressable, SpawnThing() can be call multiple times continuously. Can someone explain for me what i miss?
Is there a way to control the internal names of asset bundles generated by Addressable builds? It seems like it creates big, crazy long, obtuse, unique hash names, correct?
here's an example of what I am talking about
as far as I can tell, Addressables auto generates these without any documentation as to how or what the names mean
sadly no, those set the external names of asset bundles
basically only the filenames
internally, asset bundles have different names
here's an example using the Asset Bundle Browsing tool to read the internal data of an Asset Bundle made by addressables
it gives the internal Name field a hash (which is different than the hash Addressables can append to the filename), and then the Dependency names are also different from both the Name field hashes and also generated somehow and for some reason.
assets_example_a7001bddbca3a53b33baf95c5ba52b07.bundle this is the filename of the assetbundle, and it is what Bundle Naming Mode controls.
I am sure there is code somewhere in the Addressables source code for controlling this, it just appears to not be exposed to me as a user unfortunately. So, I'll have to write my own custom build script or go hunting for it to modify it I suppose.
Unity Tip
UI will scroll through if you input anything on the horizontal and vertical axis
to disable this just make a blank input in player setting and assign it to the horizontal and vertical axis
is there a way to abort all LoadAssetAsync? i'm currently implementing some tests of monobehaviours that use addressables and i get errors because i quickly destroy some of them while they are still waiting for addressables to load. This causes the completed callbacks to trigger after the object is already destroyed
you could store the tasks as you start them, and loop through them asking them to stop
that's kind of my fallback solution but i hoped that there's a less "manual" solution, especially considering i only need this in tests and not in the production code.
if the MonoBehaviours are storing the addressables, you could have them stop during the OnDestroy method
Anyone knows how to Load Scene with Physics mode in Addressables, it seems like Addressables.LoadSceneAsync don't allow Physics mode parameter.
Hi, How can I fix download bundle file name if I work in difference machine?
Unfortunately addressables doesn't provide a way to do this, and you can't implement your own ISceneProvider to support this because there is no public constructor to set the values of a SceneInstance. You basically need to use LoadResourceLocations with typeof(SceneInstance) to find the scene paths and then use SceneManager.LoadSceneAsync yourself
The InternalId of the IResourceLocation contains the scene path
It sounds like a great way to work around this problem. Thank you a lot.
// Find all of the possible locations for the scene
IList<IResourceLocation> locations = await Addressables.LoadResourceLocationsAsync(sceneName, typeof(SceneInstance)).Task;
// Retrieve the scene path
string scenePath;
if (Addressables.InternalIdTransformFunc != null)
scenePath = Addressables.InternalIdTransformFunc(locations[0]);
else
scenePath = locations[0].InternalId;
// Load it normally
SceneManager.LoadSceneAsync(scenePath, new LoadSceneParameters
{
loadSceneMode = LoadSceneMode.Single,
localPhysicsMode = LocalPhysicsMode.None
});
something like this basically
god it looks a lot more complicated than what I thought. Love you man.
AsyncOperationHandle<IList<IResourceLocation>> loadHandle = Addressables.LoadResourceLocationsAsync(additiveScene, typeof(SceneInstance));
// loadHandle.Completed += OnFindLocationsForScene;
yield return loadHandle;
IList<IResourceLocation> locations = loadHandle.Result;
string scenePath;
Debug.Log($"OnFindLocationsForScene : {locations[0].InternalId}");
if (Addressables.InternalIdTransformFunc != null)
{
scenePath = Addressables.InternalIdTransformFunc(locations[0]);
}
else
{
scenePath = locations[0].InternalId;
}
Debug.Log(scenePath);
yield return SceneManager.LoadSceneAsync(scenePath, new LoadSceneParameters
{
loadSceneMode = LoadSceneMode.Additive,
localPhysicsMode = LocalPhysicsMode.Physics3D
});
@minor tinsel So I implemented based on your code, it got the scenePath correctly but there is runtime error at SceneManager.LoadSceneAsync
Hmm, you'll need to load the related bundle
Okay so, it looks like what you need to do is get the IResourceLocation's dependencies and load them
Try adding
if (locations[0].HasDependencies)
{
yield return Addressables.LoadAssetsAsync(locations[0].Dependencies, _ => {});
}
before you do LoadSceneAsync
looks like it doesn't have dependancies, still the same error
That's odd, that's basically all the built-in scene load stuff does
oh hmm
one sec
if (locations[0].HasDependencies)
{
yield return Addressables.LoadAssetsAsync<IAssetBundleResource>(locations[0].Dependencies, _ => {});
}
try that
still doesn't work, it never gets to that LoadAssetAsync because HasDependencies returns False
That's... weird
since that's what the addressables API does
oh lol I think I see the problem
it should actually work in a build, but there's something else you have to do in the editor
one sec
@cursive mulch
var handle = Addressables.LoadResourceLocationsAsync(additiveScene, typeof(SceneInstance));
yield return handle;
var location = handle.Result[0];
string scenePath;
#if UNITY_EDITOR
bool bundle = false;
#endif
if (Addressables.InternalIdTransformFunc != null)
scenePath = Addressables.InternalIdTransformFunc(location);
else
scenePath = location.InternalId;
if (location.HasDependencies)
{
var depHandle = Addressables.LoadAssetsAsync<IAssetBundleResource>(location.Dependencies, null);
yield return depHandle;
#if UNITY_EDITOR
foreach (IAssetBundleResource resource in depHandle.Result)
{
if (resource != null && resource.GetBundle() != null)
{
bundle = true;
break;
}
}
#endif
}
var parameters = new LoadSceneParameters
{
loadSceneMode = LoadSceneMode.Additive,
localPhysicsMode = LocalPhysicsMode.Physics3D
};
#if UNITY_EDITOR
if (bundle)
yield return SceneManager.LoadSceneAsync(scenePath, parameters);
else
yield return EditorSceneManager.LoadSceneAsyncInPlayMode(scenePath, parameters);
#else
yield return SceneManager.LoadSceneAsync(scenePath, parameters);
#endif
thank you, I will try it later and report to you soon. Very lucky to have you.
It's kinda ridiculous that Addressables doesn't already expose this functionality lol
Hey guys, for a solo dev working on a medium sized game, is it worth investing time to work with addressables when the game is at 20% progress or later on at 60-80%?
I am beginning to understand the value, but i think it adds way more friction at the early stages.
I need to create WebGL and Standalone builds which use Addressables. However, the standalone builds need to load local bundles and WebGL needs to load remote only. How would you do this? The build/load paths are set per group, but you can’t have the same assets in two different groups…
Hmmm, is it bad practice to set the remote build and load paths in the profile to the local paths? That should solve this issue, but it seems like this might not be the intended use
personal question, how can you learn to do all of this?
I just looked through the source code of Addressables.LoadSceneAsync and followed the logic to figure out what it did
wow that's great. Thanks for sharing.
How can I config unity addressable in difference machine can download same build file?
Why addressable not support asset bundle file that build from difference "addressable_content_state.bin" on remote mode?
I mean same unity project but difference project folder location.
I'm getting the error "Exception: Attempting to use an invalid operation handle"
` public async Task<Sprite> Load()
{
_handle = assetReference.LoadAssetAsync<Sprite[]>();
_value = await _handle.Task;
return Value;
}`
The other part is that calls load is:
public async Task SetSprite(Sprite3DResource sprite) { _sprite.Release(); _sprite = sprite; _renderer.sprite = await _sprite.Load(); }
any clue on what I'm doing wrong?
to make it clear, it gives the error as soon as the game is on, because it has:
private async Task OnEnable() {await SetSprite(_sprite);}
private void OnDisable() {_sprite.Release();}
Release code is as follows:
public void Release() { if (_handle.IsValid()) {Addressables.Release<Sprite[]>(_handle);} }
My gut tells me that the first one will be faster, because the second one will always have to resolve the instance in some way even if it caches it
Whereas with option 1, you resolve the instance once and have it right there
An earlier version of the documentation actually mentions this: https://docs.unity3d.com/Packages/com.unity.addressables@1.14/manual/InstantiateAsync.html
The downside to using this API is that it incurs overhead that can be mitigated by handing instantiation manually.
So I tested it out and it worked for local load but with remote load it still gave the scene couldnt be load error. Kinda weird. All the AsyncOperatorHandle completed successfully.
I might've missed something while looking at the internal logic
I'm not familiar with remote loads so I wouldn't be surprised if that were the case
Looks like the only other thing it does is modify the path when in the editor
try changing
#if UNITY_EDITOR
if (bundle)
yield return SceneManager.LoadSceneAsync(scenePath, parameters);
else
yield return EditorSceneManager.LoadSceneAsyncInPlayMode(scenePath, parameters);
#else
to
#if UNITY_EDITOR
if (bundle)
yield return SceneManager.LoadSceneAsync(scenePath, parameters);
else
{
if (!scenePath.ToLower().StartsWith("assets/") && !scenePath.ToLower().StartsWith("packages/"))
scenePath = "Assets/" + scenePath;
if (scenePath.LastIndexOf(".unity") == -1)
scenePath += ".unity";
yield return EditorSceneManager.LoadSceneAsyncInPlayMode(scenePath, parameters);
}
#else
Aside from that, everything appears to be identical to how Addressables.LoadSceneAsync works
oh my mistake for making it clear, I tested on build version, not editor version. Editor works fine for me.
how can I get a list of keys for assets with a certain label
I can LoadAssetsAsync with "MyLabel" but then I only have prefabs without the original key they had
var loadResourceLocations = Addressables.LoadResourceLocationsAsync(new[] { "MyLabel" }, typeof(GameObject)); does not return anything
hmm weird. it works now
not working: var loadResourceLocations = Addressables.LoadResourceLocationsAsync(new[] { "MyLabel" }, null);
working: var foo = Addressables.LoadResourceLocationsAsync("MyLabel", null);
any idea why?
it also returns 5 identical primarykeys per entry
Does HasDependencies return true?
It's possible maybe it needs a bundle and it's not being loaded or something
Yes it returns true
Hmm, what if you log the scene path, does it look valid?
Could also enable this part in a build and log if each bundle loads correctly:
#if UNITY_EDITOR
foreach (IAssetBundleResource resource in depHandle.Result)
{
if (resource != null && resource.GetBundle() != null)
{
bundle = true;
break;
}
}
#endif
As far as I can tell this should be functionally identical to Addressables.LoadSceneAsync so there must be something subtle I'm missing
The log looks valid
I try a build with local load option and it works fine btw. Just something wrong with remote
Yeah, that is really strange
And Addressbles.LoadSceneAsync works perfectly fine with remote?
Also which version of the addressables package are you using? Maybe I was porting code from an incompatible version or something
Gotta step away for a bit to get some stuff done IRL, but if you'd like I'll ping you when I get back to investigate further
Yeah it works fine
Im using version 1.18.19
Yeah I would love a ping, thanks man.
@cursive mulch Interesting, I made that function by reading version 1.19.17's code
So maybe 1.18.19 has differences
Hmm, appears to be the same, though I suppose there is one thing I missed when translating the code
@cursive mulch try this https://gist.github.com/DaZombieKiller/c1cefdab063b1e4aab1e13f944192448
I noticed that the code still iterates over the bundles and calls GetAssetBundle even in builds, so maybe that actually loads them
If that still doesn't work, and you're on Unity 2020.3 or higher, as a last resort you can override SceneManager.LoadSceneAsync using https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManagerAPI.html to modify SceneLoadParameters depending on the scene being loaded
this works, thank you a lot
awesome
- Questions about Addressable
- How to perform the hot update of Addressable
- How to set the Shader variable of SceneView camera
- The reason why Activity defaults to SingleTask
- About the Resources.UnloadUnusedAssets call time is too long
Questions about Addressable
https://blog.en.uwa4d.com/2022/01/20/questions-about-addressable/
We have two layers of cognition on Assets: one layer comes from Unity’s default project directory Assets, and the other layer comes from Unity’s packaging system AssetBundles. Therefore, we will normalize from these two aspects to understand what Unity’s Assets are.
Addressable Chapter 1: Assets – Unity Asset Reference
https://blog.en.uwa4d.com/2022/02/22/addressable-chapter-1-assets-unity-asset-reference/
- Questions about Addressable 2) How to perform the hot update of Addressable 3) How to set the Shader variable of SceneView camera 4) The reason why Activity defaults to SingleTask 5) About the Resources.UnloadUnusedAssets call time is too long Today, we continue to select a number of issues related…
This article is the first chapter of the Addressable series. What are Assets? Generally speaking, we have two layers of cognition on Assets: one layer comes from Unity's default project directory Assets, and the other layer comes from Unity's packaging system AssetBundles. Therefore, we will normalize from these two…
Those topics are easy for your guys to check out the issue you probably rencounter in the future.
Hi, these addressables are a bit confusing. Hoping someone can help me out with my understanding! I have some questions about this bit of code:
{
for(int i = 0; i < 10; i++)
{
string key = "Prefab";
//preload to gain access to the handle.Result, so that we can supply the rotation of the source prefab to the instantiated prefab
var preLoadHandle = Addressables.LoadAssetAsync<GameObject>(key);
yield return preLoadHandle;
if(preLoadHandle.Status == AsyncOperationStatus.Failed)
{
Addressables.Release(preLoadHandle);
throw new Exception("Addressable not found");
}
var instantiateHandle = Addressables.InstantiateAsync(key, preLoadHandle.Result.transform.position, preLoadHandle.Result.transform.rotation);
//result should be immediately available
instantiatedPrefabs[i] = instantiateHandle.Result;
Addressables.Release(preLoadHandle);
}
}```
-
Do you see anything wrong with this code? I am using LoadAssetAysnc together with InstantiateAsync, mainly because I need to access the rotation and position values of the underlying prefab asset when instantiating the game object that will be used in the scene.
-
I believe the ref count should be 2 after the InstantiateAsync call, then 1 after the first Release call. Is that correct?
-
Does the Release call release the underlying asset bundle, or because the ref count is still at 1, the asset remains in memory?
-
If my understanding of the ref count is correct, then subsequent LoadAssetAsync calls should not actually load in a new asset bundle, but instead detect that the asset is already loaded and use that for its Result. Is that correct?
-
All InstantiateAsync calls should use the asset loaded with the first LoadAssetAsync call, right?
-
Let's ignore that this is a loop. Instead, imagine that the subsequent calls to LoadAssetAsync and InstantiateAsync occur at a later time, but it's always true that at least one instance of Prefab still exist in the scene. These calls will not force a new asset bundle to be loaded into memory, correct?
Okay, so perhaps I different question then.
If I want to load multiple addressable assets at the same time, what is the best way?
- Individual calls to LoadAssetAsync and I track the load operations manually.
- Using LoadAssetsAsync
- Using CreateGenericGroupOperation
Are 2 and 3 simply convenience features that allow you to track group progress as a whole? Or is there some efficiency advantage to them? I am concerned that those two methods will cause garbage generation due to the list that is returned. I also don't like that the whole operation seems to fail if any one asset fails to be downloaded/found. So I would lean towards 1, but don't know if it is inefficient to use that method.
Why when editing prefab quite slow than normal on addressables asset folder?
Is it normal that the GetDownloadStatus().Percent function always returns 0 when trying to load addressables from local folders ?
Unity 2021.2.14f with Addressables 1.19.19
I wanted to show the download progress but it keeps returns 0 in the yield loop.
Yes it’s 0 because it is essentially “already downloaded”. Might be quite difficult to show an accurate progress bar - I’m not sure if there’s any other api call for monitoring the progress of eg the decompression for large bundles.
Ok, I see. I'll just show a loading icon then without the actual progress, that'll be enough. Is this information written on the documentation page regarding local content returning 0? I don't remember seeing that. It might be worth mentioning.
Hi everybody! My first post, so I hope I'm not breaking any rules etc. by asking this question. I want to load some songs at runtime from a folder on my local drive. ( not inside unity assets folder). Would addressables be the correct way to go about this. I assume asset bundles wouldn't work. I've managed to obtain some data outside of the assets folder by getting URLs via JSON file and managed to get 1 song only via UnityWebRequestMultimedia.GetAudioClip too. The problem with the things I've tried so far have limited me to single files,audio,videos only. As mentioned I'm wanting to include several songs at runtime from outside of unity assets folder. So are addressables the correct way to go about this or is there other options available to me?
mmm...no. if you want to load sound at runtime that was not included when building, use the streaming assets folder and just load the files themselves. no need for asset bundles or addressables
be aware, last time i checked, you cannot load .mp3 at runtime because of licencing
@charred osprey do you mean that you want to be able to load external music into the game
you would be using file operations in that case, and would need to convert them into an audio clip
looks like this SO question uses WWW to accomplish this:
but WWW is fairly old, so perhaps see if there's a way to do it using UnityWebRequest
it is pretty much the same with UWR but like i said, you prob won't be able to use .mp3 because licencing (and that's built into unity)
the SO also indicates this
but maybe the .mp3 licensing ran out since then
SO says it works with mp3
haven't checked
just saying that i did encounter that before
yeah, last time i implemented it was with 2017 or 2018 i think but .ogg is better anyway XD
and yeah he stated previously that .mp3 doesn't work on windows. but apparently that ran out now. hooray
yay
just tell it to your users. or convert it XD
not really. because licensing
XD
good to know
what is taking its place?
AAC and others
@wooden moss Streaming Assets Folder. I'll look into this. I wasn't aware of that option. So .mp3s are legal now i assume. Basically i've made a set of DJ turntables to mix with and the DJs will likely have .mp3 files in their playlist. Getting them to convert their files would likely be problematic because people don't like taking extra steps. 😄
yeah. definitely look into the StreamingAssets folder though. pretty much best place for anything that wasn't there when building your game. aka everything the user wants to add etc
that sounds the ideal approach for me. Cheers Mindstyler. I'll look into that and try dig some info about using streaming assets folder instead