Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

iOS assetbundle using Particles/xxx shader NOT works at Unity 4.3.x ?

Discussion in 'iOS and tvOS' started by hollycq, Mar 7, 2014.

  1. hollycq

    hollycq

    Joined:
    Sep 20, 2012
    Posts:
    14
    my ios assetbundles using Particles/Alpha Blended shader NOT work at Unity 4.3.x, but work fine at Unity 4.2.x. And I tryed other Particles/xxx shaders. They all failed like this.
    $20140306-5.png

    Thanks for any help
     
  2. Steven-Walker

    Steven-Walker

    Joined:
    Oct 27, 2010
    Posts:
    38
    Running into the same issue. Did you find a work-around for this?
     
  3. Steven-Walker

    Steven-Walker

    Joined:
    Oct 27, 2010
    Posts:
    38
    I found the solution. Do one of the following:
    • Change the shader type to "Mobile/Particles/Alpha Blended"
    • Or use your own custom shader
    I am guessing that this is due to the build being for iOS and the built-in shader "Particles/Alpha Blended" is not supported.

    If you are using any Particle Systems with the Default-Particle virtual material, you will have to create a new material and texture to assign.
     
  4. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    This thread is really old but I just hit this issue and I wanted to share the code that fixed it for me. Basically, I re-link the shader when the asset bundle loads. Kind of a hacky solution, but this way I don't have to go through all my asset bundles (there are a lot) fixing the shaders:

    // TODO fix asset bundle dependency that would make this irrelavent
    // This is to match up shaders with the complied version on client
    Renderer[] renderers = obj.transform.GetComponentsInChildren<Renderer>();
    foreach (Rendererrendererinrenderers) {
    if (string.Compare(renderer.sharedMaterial.shader.name, 0, "Particles/", 0, 10) == 0) {
    Shadershader = Shader.Find(renderer.sharedMaterial.shader.name);
    if (shader)
    {
    Debug.Log(renderer.sharedMaterial.shader.name+" found "+shader.name);
    renderer.sharedMaterial.shader = shader;
    } else {
    Debug.Log(renderer.sharedMaterial.shader.name+" found no matching shader");
    }
    }
    }
     
  5. gyd

    gyd

    Joined:
    Nov 9, 2012
    Posts:
    15
    Same issue on 5.1.2