Search Issue Tracker

Fixed in Unity 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

--

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 0Severity not yet defined

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 (30)

  1. 67bd3ee91878b81338f05204f22233c1?d=mm

    brinisabderrahmen93

    Mar 18, 2019 10:45

    this worked for me but in built game you should put a list of shaders to build in settings or put the min a built scene that can never navigate to xD`using System.Collections; using System.Collections.Generic; using UnityEngine;
    this script should be putted in the parent of the asset bundle spawner and call FixeShaders Function just afterspawning the prefab from assets bundle
    public class ShaderBrinisFixe : MonoBehaviour {

    // Create a material from code
    public void FixeSahders()
    {
    // Create a material with transparent diffuse shader

    // assign the material to the renderer
    foreach (ParticleSystemRenderer p in gameObject.GetComponentsInChildren<ParticleSystemRenderer>())
    {
    p.material.shader= Shader.Find(p.material.shader.name);
    }
    }
    } `

  2. D9246e6262c47c376b0b84ab59ca72a8?d=mm

    SteveJLV

    Apr 01, 2017 06:36

    Just upgrade Unity and my bundel comes in but the shaders are blank. Texture name is there but in scène everything is pink. Of i manualy set shaders to standaard everything is fine. Unfortunate you can nog select all imported objects and set their shaders, thuis component disapears when multiple selecting

  3. E422b6043f99309c7664b2bd2046071c?d=mm

    BoboShu

    Mar 21, 2017 08:33

    it still happend on 5.5.2f1

  4. 2f881e8e1d0bcc10b86ce2c85ede19a4?d=mm

    Amazi

    Mar 07, 2017 06:51

    Why has this been resolved when it isn't fixed? This is still occurring on my version 5.4.3f1 (pro).

    Please can someone respond rather than ignoring the issue for the last two years and then falsely claiming it is fixed.

  5. E3fe4e9278b4b76a13e21cdb8e28cc60?d=mm

    ganusajjan

    Feb 28, 2017 18:27

    Is it fixed with 5.4 version of Unity?? Still i'm facing this issue!!

  6. 60e592000d89eaa2edfe29af496e1d57?d=mm

    JakeMuehleff0000

    Jan 13, 2017 23:19

    This issue is not fixed. Please do not resolve issues that are still broken.

  7. 2f6d89225aefd20b12cf7453eec3ae8f?d=mm

    marcopaivaf

    Dec 15, 2016 21:10

    Besides making sure that or Asset Bundle is built for your target platform, you need to make sure to clean the Asset Bundle cache from the previous time you downloaded it.

    I am using 5.5.0f3, and I always had this issue when using Asset Bundles. I fixed the issue today, by doing a couple of things:

    1. I made sure that the shader that I wanted to use was included in the Asset Bundle (I have a custom Standard Surface Shader);
    2. I made sure that I am building my Asset Bundle for my target platform (In my case, I am working on a Windows machine, targeting Windows 64);
    3. I included my custom shader to the "Always Included Shaders" list inside the Project Settings -> Graphics;
    4. I cleaned my Asset Bundle cache by running "Caching.CleanCache()" from an Editor script;
    5. Built Asset Bundle;

    Hope that helps someone =)

  8. D02ee51101c5cfd7c6510fed1aeae77c?d=mm

    ADaurio

    Oct 21, 2016 15:09

    This has not been resolved in Unity 5.4.

  9. Fe8749d544b983c1c8e6b2c7aa145432?d=mm

    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.

  10. Cd0dc1ac4e0a9fa46592c7296d4489eb?d=mm

    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!

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.