Sharing materials between asset bundles

Hey,

I’ve researched about asset bundles for our game which is ran on web and iOS.

I’m wonder there are a way to share materials between different asset bundles.

For instance, there are two terrain map, terrain A and terrain B for game levels.

Terrain A and Terrain B has different geometry data but same for its materials such as textures.

In this case, is that possible to share same materials and textures between those two asset bundles?

As I’ve been understood, it seems to be like that it is impossible to share materials between asset bundles.

Any ideas?

Thank you.

Best,

-Kim

Your terrainA and terrainB share same shader texture But material.

Share textures :

BuildPipeline.PushAssetDependencies();

foreach (Texture t in allTex)
{
BuildPipeline.BuildAssetBundle(t, null, exportPath);
}
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildStreamedSceneAssetBundle(new string[ ] { “terrain1” }, terrain1exportPath, BuildTarget.WebPlayer);
BuildPipeline.BuildStreamedSceneAssetBundle(new string[ ] { “terrain2” }, terrain2exportPath, BuildTarget.WebPlayer);
BuildPipeline.PopAssetDependencies();

BuildPipeline.PopAssetDependencies();

In this case, You Should DownLoad TextureAssetBudnle First!
(download terrainAssetbundle first is also works but more complex)

Thank you for the answer.

I’ll try.