Search Unity

Legacy lightmapped shaders - Broken?

Discussion in 'Editor & General Support' started by kondrup, Mar 9, 2011.

  1. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    This is a very frustrating issue and a bit hard to explain.

    We just recently converted to unity 3.2 - and to our horror we discovered that all our lightmapped assets got pink (missing shader) when we built them into an asset bundle. We soon found out, that we should edit the built-in lightmapped shaders and save them to some place in the assets folder.

    But something does not work properly and we are not even 100% sure what it is. I seems like the legacy shaders we saved in another location are locked somehow.

    What we basically just want to do is, to have our old trusty lightmapped/specular shader working again.

    Is it possible to tell unity that all materrials using "this" shader should instead use "that" shader?
    - (we could then make our own lightmapped shader and use that instead of the built-in)

    We have at least 10.000 materials using this lightmapped/specular shader, so converting them manually is not an option :)
     
  2. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560

    You can copy/paste the shader code from the ones you want, into the shader thats being used by way of downloading the builtin shaders (which Unity then uses over the built in built in ones). Only really an option if they all use the same shader, and there's not a better alternative. I think there was a script on the wiki that let you change many materials at once, but that was 2.6.1 days and may not work for 3.2.
     
  3. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    This is unfortunately not possible with the legacy shaders - we have already tried this :/

    These materials are scattered across a large project, so the script you mention would also not be an option.

    If it is possible to search through all materials somehow and check if the material is using legacy/lightmapped/specular shader and then change the shader to another one - that would be the greatest solution.
     
  4. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Are you sure, if you download the builtin shaders from the site, you'll find the legacy ones in builtin_shaders\DefaultResourcesExtra changing those to what you need and then copying them to your project should make them override the builtin ones automatically like the others do. Course if I'm wrong then ignore that.

    There probably is a way to write a script that does what you're asking though, to search through and change things. You could try asking in the scripting section, see if someone knows of one, or perhaps wrote one themselves that you could use. Worth a try.
     
  5. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
    Thanks for your comments, I will try posting the problem in the scripts forum
    btw. we are willing to pay for a solution :)
     
  6. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    And if I knew offhand how to do it with a script, I'd be willing to be paid to provide said solution hehe. All I can think though is there -should- be a way to do it. I'd be very surprised if it couldn't be done at all.
     
  7. kondrup

    kondrup

    Joined:
    Apr 23, 2009
    Posts:
    205
  8. Dover8

    Dover8

    Joined:
    Aug 20, 2010
    Posts:
    94
    I've come across a similar problem where all our asset bundles using the Legacy Lightmap Shader have turned pink in the webplayer. However rebuilding each asset in 3.2 is enough to fix them, though it depends how feasible it is for you to rebuild each asset, I've had to put aside a week to go through all of ours.