Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 2 asset bundles to Unity 3

Discussion in 'Scripting' started by Flynn, Aug 24, 2012.

  1. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Hello! I have recently taken over a project which was built for Unity 2, and I'm developing it in Unity 3. Unfortuantely, that project amassed a collection of hundreds of worlds all exported to asset bundles from Unity 2 pro...


    The import just fine! The only problem is with the shaders -- A TON of the shaders people used (and they were very simple shaders, nothing that even requires Unity pro!) are no longer compatible with U3... To further complicate things, these shaders aren't even converted to a U3 compatible form when they are imported.


    Anyways, I was wondering if there is a way for me to create my OWN shader conversion, which can get a list of all the shader assets in the bundles I have loaded, modify them so that they are U3 compatible, and then have the rest of the code work on those shader assets, not the originals. Unfortunately none of the code I have directly interacts with shaders, it just loads asset bundled scenes, so I would have to edit the bundles directly upon import in order for the changes to be visible.


    So, there you have it! How can I automatically convert shaders upon import, while working within these specifications?


    Thankyou! -- Flynn


    P.S. the project I am referring to uses Whirld 3 by Aubrey Falconer for its asset importing. The source code of my importation is exactly the same as this: http://aubreyfalconer.com/view-6853
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You can put the shaders into the Unity 3 project, have it converted there and reexport the asset bundles.

    Asset Bundles are not compatible with other minor versions than the one for which they were created for (so a 2.x asset bundle will never work in 3.x, a 3.1 will not work in 3.4, a 3.4 not in 3.5 etc), as such you will not be able to avoid an upgrade of the bundles independent of what you do.
     
  3. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Due to the sheer mass of worlds, and the fact that I do not have Unity Pro, going in and manually upgrading every world is not an option :( I know that shaders are sent as text, so is there any way to modify those text files programmatically before they are loaded into a scene...?
     
  4. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    So, I've done some more research into this... It looks like my only option will be to somehow gather all of the shaders in a scene, get their source as text, edit that text, and then compile that text to shaders, and redistribute the shaders...


    How exactly do I get the source text of a shader...?
     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can't if you don't have it already.

    And this is not gonna help as mentioned.
    Unity 2.x asset bundles will not load in unity 3 independent of what you do, unity will throw an error when you try to load it.
    Same as with 3.0 to 3.1 to 3.2 to 3.3 to 3.4 to 3.5 as the asset format has changed radically.


    If you don't have pro I don't get the picture anyway though as you can not make use of them without pro legally.
     
  6. Flynn

    Flynn

    Joined:
    May 24, 2009
    Posts:
    311
    Unity indie can still import asset bundles, it just can't export them. The asset bundles load just fine in Unity 3 as well. The only problem is that a bunch of custom shaders are showing up pink, and I'd like to stop them form being pink. Very specifically, they are having parse errors. I was hoping to make my own syntax interpreter which can convert the syntax from Unity 2.x to Unity 3.55


    So you know of no way of modifying the shaders once they are loaded? :(


    You probably wonder why I keep asking, but, you keep telling me reasons that I should not ask, and these reasons seem invalid to me because the problems they describe are not what I am experiencing. I think we may be having a communication issue, and this is why I am continuing to ask
     
    Last edited: Aug 28, 2012