Search Issue Tracker
Fixed in 5.4.0
Votes
116
Found in
5.1.3f1
Issue ID
722725
Regression
No
Materials lose reference to textures if loaded from Asset Bundles
How to reproduce:
1. Open attached project
2. Open scene Scenes/AtlasedSpriteParticleTest.unity
3. Go to Build/AssetBundle
4. Play the scene
- Note how the particles have no textures
Comments (34)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Layer render order is not respected inside the Android Player when using GPU Resident Drawer.
- “You are not using the recommended Android NDK, versions other than 27.2.12479018 are not officially supported.” warning is still displayed when Android SDK is set to the correct NDK version manually
- OnWillSaveAssets receives an empty paths array when saving a new Scene
- UV Node's Label is cut off when Preview is collapsed
- Dragging Search Query Block can remove its color
ADaurio
Oct 21, 2016 15:09
This has not been resolved in Unity 5.4.
CelitoOokaIsland
Oct 18, 2016 15:08
I'm still having this issue on Unity 5.4.1f1, I tried the workaround suggested by OMAR_UNITY, but no luck with it.
Since this is a problem that only happens on the editor for me, one workaround that worked was to add some lines of code only for when in the editor, where the asset loaded from AB would have its shader re-set by its name:
#if UNITY_EDITOR
foreach(Material material in [rendererLoadedAssetBundle].materials)
{
material.shader = Shader.Find(material.shader.name);
}
#endif
Maybe this issue is related to the fact that almost the same thing happens with sound sources loaded from asset bundles in the editor. They are loaded without errors, but their references to the audio mixer groups are broken, even though the naming of the references looks correct.
Omar_Unity
Oct 16, 2016 17:18
Hi, there is a possible workaround, of course, it depends on the origin of the issue every one of you is having.
You may want to take a look at this article: https://support.unity3d.com/hc/en-us/articles/208380753-Shaders-are-pink-when-loaded-from-an-AssetBundle
Cheers!
bearxiong
Oct 10, 2016 13:12
This is not resolved. Still exists in 5.4.1f1
Anemor2000
Oct 03, 2016 18:55
This is not fixed in 5.4....
Klaus-Eiperle
Sep 26, 2016 16:41
Still there in Unity 5.4.1p2. I still need to reassign all custom shaders after loading an AssetBundle with WWW. I built the AssetBundles in the OSX Editor and when I test the built game, the shaders are not loaded. The same project in a Windows Unity3D 5.4.1p2 editor shows the same problem. I can reassign the shader by hand and then all the other objects which are using the same custom shader are fixed at once. :-(
schetty
Sep 26, 2016 07:29
i have exported the assetbundle(.Unity3d) from Unity5.3.5, when i import into the file in Unity5.4 pink color is coming. But in texture i have my textures and all the details.
How do i solve this issue?
I cannot reexport all my assetbundle again from Unity5.4
Glaswyll
Sep 05, 2016 02:13
This is not resolved. Still exists in 5.4.0f3
maiacordero
Aug 19, 2016 21:15
Hi, this issue still happen in Unity 5.4.0f3 the last version.
I'm using this BuildPipeline.BuildAssetBundles(pathTemp, BuildAssetBundleOptions.None, BuildTarget.StandaloneOSXUniversal);
When I use the bundler I have lost shader references than be see in the typical pink color.
And I have to make a "hack" :
//************ HACK ! still unfixed >.<' https://issuetracker.unity3d.com/issues/materials-lose-reference-to-textures-if-loaded-from-asset-bundles?page=2#comments
Renderer[] renderers = imagesToLoad[i].GetComponentsInChildren<Renderer>();
Material[] materials;
string[] shaders;
foreach (var rend in renderers)
{
materials = rend.sharedMaterials;
shaders = new string[materials.Length];
for (int i2 = 0; i2 < materials.Length; i2++)
{
shaders[i2] = materials[i2].shader.name;
}
for (int i2 = 0; i2 < materials.Length; i2++)
{
materials[i2].shader = Shader.Find(shaders[i2]);
}
}
DearTao
Jun 15, 2016 08:03
5.3.1f1 has this issue ,when I load level from asssetbundles ,this scene lose ligntmaps,woe need reapply shaders.