I need some help with Addressables…
I’m trying to make a small Update System for future project, and i’m stuck with CheckForCatalogUpdates…
Disable Catalog Update is checked in Addressable Asset Settings
But CheckForCatalogUpdates continue to return a list with a length of 0 even if there is changes
With some testing, it appears that, if i upload an update on my CDN, Unity is able to instantiate the news Assets from the remote, but CheckForCatalogUpdates continue to return a length of 0
Here is my testing code :
public class Spawner : MonoBehaviour
{
public AssetReference localGeometry;
private List<IResourceLocation> remoteGeometry;
public AssetLabelReference geometry;
private void Start()
{
DisplayGeometry();
Addressables.InitializeAsync().Completed += objects =>
{
Addressables.CheckForCatalogUpdates().Completed += checkforupdates =>
{
if (checkforupdates.Result.Count > 0)
{
Debug.LogError("Available Update");
LocationLoaded(Addressables.LoadResourceLocationsAsync(geometry));
}
else
{
Debug.LogError("No Available Update");
LocationLoaded(Addressables.LoadResourceLocationsAsync(geometry));
}
};
};
}
private void DisplayGeometry()
{
localGeometry.InstantiateAsync(Vector3.zero, Quaternion.identity);
Debug.Log(geometry.labelString);
}
private void LocationLoaded(AsyncOperationHandle<IList<IResourceLocation>> obj)
{
remoteGeometry = new List<IResourceLocation>(obj.Result);
StartCoroutine(SpawnRemoteGeometry());
}
private IEnumerator SpawnRemoteGeometry()
{
yield return new WaitForSeconds(1f);
float xOff = -4.0f;
for (int i = 0; i < remoteGeometry.Count; i++)
{
Vector3 spawnPosition = new Vector3(xOff, 3, 0);
Addressables.InstantiateAsync(remoteGeometry[i], spawnPosition, Quaternion.identity);
xOff = xOff + 10;
yield return new WaitForSeconds(1f);
}
}
}
When i do change on my remote assets, i can see the change in the scene (more or less object spawned in the scene according to the catalog on the CDN)
So my question is: why CheckForCatalogUpdates awlays return me nothing ? Did i miss a step ?
I’m stuck since 3days and it drives me crazy, any help would be appreciated
PS: Debug.LogError is used to see messages in console on my Developement Build.
You probably have check for catalog updates on startup checked in your addressable settings, so your extra check in code right after initialization is redundant and does nothing. The CheckForCatalogUpdates API is meant to be used during normal runtime to periodically check for updates so that the player doesn’t need to restart the app.
For me it returns 1 entry which is MainCatalog. It doesn’t matter whether there is an update or not. Also when I use external server to download content update manually, it does not update content on the device, but it does in the editor. It would be great if you could share and example how to use it properly to make it work.
I’m facing a smiliar problem: I get an update when I upload a new version to my server. The problem is that this update is done automatically but I want to do it manually! I have also checked “Disable Update on Startup” but it isn’t changing anything. Updates are still done automatically. I am using Unity 2019.3.13f1 and addressables 1.10.0
Have an update from the team, it’s possible this is a bug. Would you mind filing a bug report for us?
Additionally, they are looking into creating a sample that shows how this works. It won’t be any time soon, but they can make something like that and throw it into the Addressables Samples repository.
Thanks for doing it! I was hoping for someone else creating one I think we will wait with this feature until it has been fixed. I don’t want to spend time on a workaround when they will do it as well. I did this once before and 2 weeks later there was an update where they fixed it and all my work was overdue. So we will just hope they might fix it soon.
Some updates on this one? I try to check if there are some updates on the catalog but there are always 0 elements in the list. Version I am using: 1.16.13 and Unity 2019.4.11f1
I have found the reason why I didn’t get the updates: you have to initialize the addressables system first with Addressables.InitializeAsync(); and then you can use the other methods. I didn’t initialize it manually because the documentation stated it would initialize automatically with first API call so I didn’t bother.
Thanks a lot, consider yourself kissed, COVID or not.
@TreyK-47@davidla_unity Is this a bug, and if so it is known? If it isn’t, please, you should update the documentation, because it says that Addressables.InitializeAsync is not needed to be called manually, and I can’t find anything saying that it must be called before calling CheckForCatalogUpdates, I’ve been going completely crazy trying to make it work.