Search Unity

Shaders and asset bundles

Discussion in 'Shaders' started by nsmith1024, Oct 10, 2016.

  1. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Hello,

    I build my scene into an asset bundle, when the scene is loaded dynamically during the game from the server, everything is pink, including the trees, water4Advanced etc (Im running it in the editor).

    When I look at the inspector, I see everything looks normal in that the shaders and materials are listed (does not say missing or none), but they are not drawn on the screen.

    I notice that if while the game is running in the editor, I click on the " water4Advanced Tile" object in the scene, the inspector shows shader as "FX/Water4". If i simply select that same shader again then suddenly the water appears, where before it was pink (the other objects are still pink like trees etc by the way)

    Anybody knows why?

    im using Unity 5.4.0b24

    Thanks
     
  2. matthieups

    matthieups

    Joined:
    Sep 14, 2016
    Posts:
    9
    Hi,

    got exactly the same issue here (data downloaded from an assetbundle). Everything is fine in the inspector: materials and shaders are correctly listed but everything renders pink (please note that all the shaders and materials are located in my Resources folder and that the Always Included Shaders list in the Graphics settings is up-to-date).

    Help needed!!

    Thanks
     
  3. matthieups

    matthieups

    Joined:
    Sep 14, 2016
    Posts:
    9
    Fixed! This was because my assetbundle was generated for Android or IOS using the OpenGL ES API whereas the editor/player, by default, runs the DirectX driver.
    I just had to change the PC, Mac, Unix player settings by unchecking the Auto Graphics check boxes and putting OpenGL ES as the main default Graphics API on each platform.
     
  4. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    The solution is this. If you build asset bundle for lets say WebGL variant, when you run it in the editor and it loads that asset, it will have the pink (because you are not really running WebGL, since you are running in the editor)... But when you run it for real in the browser (the real WebGL) it works, no more pink.