Hi,
I am trying to setup bundles via Addressable assets. It is a requirement from Apple that we prompt users for additional asset downloads. So we are using the feature Addressables.GetDownloadSize()
in order to get the total download size and prompt the user.
From there we are downloading Addressables.DownloadDependenciesAsync
and passing a list of addresses to download.
That functionality is working great, I am able to successfully download the bundle. It is cached so the next time I start the game all seems to be working fine. Until…
When I get to the game scene and I instantiate my Addressable Asset
_handle = Addressables.InstantiateAsync(levelAsset, new InstantiationParameters(Vector3.zero, Quaternion.identity, null), true);
_handle.Completed += OnInstantiatedComplete;
After the level is instantiated, the level shows below (Pink) in the editor and is not loaded correctly.
When I inspect one of the loaded assets, it tells me that the "Material does not have a _MainTex texture property, it is required for SpriteRenderer. However, I am using the Default Sprite Shader.
I am thinking this could be from one of two reasons, there is some bug that doesn’t process the shader correctly. Or, more likely, It can’t find the asset blocks_9 in the spritesheet “Blocks”.
I have tried a number of things to attempt to resolve this:
- I have had the asset as “built into the project”
- I have placed the assets (textures) in a Resources folder
- I have placed the assets in the bundle with the prefab.
- I have placed the assets in a new bundle group and loaded at the same time as the prefab.
None of these options work.
They way my assets are structure are as follows.
- I have a prefab called “AddressableLevel” this prefab is labeled and marked as addressable.
- I have now placed all the textures and materials in a new Group
I really need this to work, or understand the right way to make this work. My assumption, is that I can save a prefab with the configuration of and placement of my level, even if the assets are existing and built with with he project. Or in another scenario I should be able to put all the assets related for that level into a bundle group and download the prefab configuration & all the related level assets.
What am I doing wrong here?