Spawned Prefab materials loses transparency.

I’m having issues getting prefabs stored in an asset bundle to retain their transparency.

The Right Image is what the prefab looks like. But when I make an asset bundle of the prefab along with all its textures and materials, and then spawn it from the asset bundle using Instantiate(), the lid, which is supposed to be transparent, no longer is (left). The only way to make it transparent again is to manually drop the original material back onto the lid sub-object in the editor window.

If I manually drag and drop the entire prefab into the scene, the transparency does work. It only stops working when I use Instantiate(prefab, transform). What’s up that that?

Your help is appreciated.

PS:
Also, on a possibly related note, none of the material sliders on the instantiated game object does anything. I can open it in the hierarchy, move the sliders around, and none of the settings transfer over in the object. Even if I do it by script. The only thing I can change is the color.

I’ve seen this happen when you are using an asset bundle made for a device target (such as for ios or android) in the Unity editor, or on PC.

Pretty much you need to only run the target asset bundles with the target builds, which means for the Editor you want PC / Mac builds of the asset bundle data.

Ah ok, I am indeed running Android asset bundles in the Windows Editor. I’ll package a windows bundle and see if it changes. Thanks for the heads up!

EDIT:

That was indeed the problem. Thanks again! :slight_smile:

1 Like