Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.29k stars 298 forks source link

PAD sample does not build #83

Open michalpypek opened 1 year ago

michalpypek commented 1 year ago

The current PAD sample does not build an aab correctly.

Repro steps; -Build addressables with the PAD script -Try to build an .aab

The gradle build will fail with main/src/assets not found exception for both custom packs - fast-follow and on-demand.

Changing the build script to put bundles into *.assetpack/src/main/assets makes it build, and the builds "work" when buildintg them using bundletoot with --local-testing, but the assets aren't pulled correctly when the build is downloaded from google play.

restush commented 1 year ago

Same problem, but there is a workaround. See this https://forum.unity.com/threads/pad-unity-2021-3-not-created-src-main-assets-automatically-for-custom-asset-bundle.1389945/

michalpypek commented 1 year ago

Yes, as I said - changing the script to move the bundles to src/main/assets folder by hand - "works" But still - when loading in a fast-follow pack it doesn't seem to work:

image

However, when downloading from google play and trying to load an asset from a fast-follow pack I get an error:

01-30 12:33:52.416: E/Unity(27352): Failed to retrieve the state of asset pack 'CustomFastFollow'.
01-30 12:33:52.416: E/Unity(27352): AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider:CheckDownloadStatus(AndroidAssetPackInfo)
01-30 12:33:52.416: E/Unity(27352): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
01-30 12:33:52.416: E/Unity(27352): UnityEngine.AndroidJavaProxy:Invoke(String, Object[])
01-30 12:33:52.416: E/Unity(27352): UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)
01-30 12:33:52.416: E/Unity(27352): OperationException : Provider of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider with id AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider has provided a result of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider which cannot be converted to requested type UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource. The operation will be marked as failed.
01-30 12:33:52.416: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
01-30 12:33:52.416: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
01-30 12:33:52.416: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1:ProviderCompleted(T, Boolean, Exception)
01-30 12:33:52.416: E/Unity(27352): UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle:Complete(T, Boolean, Exception)
01-30 12:33:52.416: E/Unity(27352): AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider:CheckDownloadStatus(AndroidAssetPackInfo)
01-30 12:33:52.416: E/Unity(27352): System.Reflection.RuntimeMethodInfo:Invoke(Object, BindingFlag
01-30 12:33:52.419: E/Unity(27352): Exception: Provider of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider with id AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider has provided a result of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider which cannot be converted to requested type UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource. The operation will be marked as failed.
01-30 12:33:52.419: E/Unity(27352):   at UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1[TObject].ProviderCompleted[T] (T result, System.Boolean status, System.Exception e) [0x00000] in <00000000000000000000000000000000>:0 
01-30 12:33:52.419: E/Unity(27352):   at UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle.Complete[T] (T result, System.Boolean status, System.Exception exception) [0x00000] in <00000000000000000000000000000000>:0 
01-30 12:33:52.419: E/Unity(27352):   at AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider.CheckDownloadStatus (UnityEngine.Android.AndroidAssetPackInfo info) [0x00000] in <00000000000000000000000000000000>:0 
01-30 12:33:52.419: E/Unity(27352):   at Syste
01-30 12:33:52.424: E/Unity(27352): OperationException : GroupOperation failed because one of its dependencies failed
01-30 12:33:52.424: E/Unity(27352): OperationException : Provider of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider with id AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider has provided a result of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider which cannot be converted to requested type UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource. The operation will be marked as failed.
01-30 12:33:52.424: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
01-30 12:33:52.424: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
01-30 12:33:52.424: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.GroupOperation:CompleteIfDependenciesComplete()
01-30 12:33:52.424: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.<>c__DisplayClass57_0:<add_CompletedTypeless>b__0(AsyncOperationHandle`1)
01-30 12:33:52.424: E/Unity(27352): System.Action`1:Invoke(T)
01-30 12:33:52.424: E/Unity(27352): DelegateList`1:Invoke(T)
01-30 12:33:52.424: E/Unity(27352): UnityEngine.ResourceManag
01-30 12:33:52.457: E/Unity(27352): System.Exception: Dependency Exception ---> UnityEngine.ResourceManagement.Exceptions.OperationException: GroupOperation failed because one of its dependencies failed ---> UnityEngine.ResourceManagement.Exceptions.OperationException: Provider of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider with id AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider has provided a result of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider which cannot be converted to requested type UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource. The operation will be marked as failed.
01-30 12:33:52.457: E/Unity(27352):    --- End of inner exception stack trace ---
01-30 12:33:52.457: E/Unity(27352):    --- End of inner exception stack trace ---
01-30 12:33:52.457: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
01-30 12:33:52.457: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
01-30 12:33:52.457: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:I
01-30 12:33:52.491: E/Unity(27352): OperationException : Dependency operation failed with System.Exception: Dependency Exception ---> UnityEngine.ResourceManagement.Exceptions.OperationException: GroupOperation failed because one of its dependencies failed ---> UnityEngine.ResourceManagement.Exceptions.OperationException: Provider of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider with id AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider has provided a result of type AddressablesPlayAssetDelivery.PlayAssetDeliveryAssetBundleProvider which cannot be converted to requested type UnityEngine.ResourceManagement.ResourceProviders.IAssetBundleResource. The operation will be marked as failed.
01-30 12:33:52.491: E/Unity(27352):    --- End of inner exception stack trace ---
01-30 12:33:52.491: E/Unity(27352):    --- End of inner exception stack trace ---.
01-30 12:33:52.491: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:set_OperationException(Exception)
01-30 12:33:52.491: E/Unity(27352): UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:Complete(TObject, Boolean, Exception, Boolean)
michalpypek commented 1 year ago

Okay, I dd a few tries, and it seems the above is caused by... fast-follow packs not working together with nested prefabs. The setup was simple: -- a cube prefab --- a nested capsule prefab inside the cube

Both assets were in the same group.

Moving the assets to an on-demand group makes them load in correctly.

Loading in a regular prefab from a fast-follow pack works as well

EDIT: Nope, it doesn't. As soon as I added another prefab to the group (a simple cube)- it broke. Neither pack together nor pack-separately work... Something is very broken with the fast-follow asset packs....

restush commented 1 year ago

I'm not sure about the error. I'm just wondering what make you use Fast Follow rather than OnDemand?

Maybe you coukd try make async like this https://github.com/Unity-Technologies/Addressables-Sample/issues/66#issuecomment-1408090035