Search code examples
c#androidunity-game-engineparticle-system

Unity3D Particle system on UI wont display in build


I have followed this particular tutorial: https://www.youtube.com/watch?v=ir9Rvi1QG8Y to add a particle system effect on a UI panel. It works well in scene mode and game mode but when built for android no particles are shown. I have tried tweaking the particle shader, material etc.. but to no avail. What do you recommend please? Thanks.

Unity version: 2018.2.11f1 Screenshot1 Screenshot2


Solution

  • After recreating the project myself I've found out that its because of a sloppy code in UIParticleRenderer class.

    Shader foundShader = Shader.Find("UI/Particles/Additive");
    

    in line 79

    when you try the game in Editor "Find" method works correctly, but when you want to publish it to a device (android) it won't include "UI/Particle/Additive" shader so the shader won't be found.

    there are 3 solutions to this problem as described for Shader.Find class in Unity documentation :

    1. reference it from some of the materials used in your scene
    2. add it under "Always Included Shaders" list in ProjectSettings/Graphics
    3. put shader or something that references it (e.g. a Material) into a "Resources" folder.

    I used the 2nd solution (which is easier to do) and it solved the problem. so you can go to Edit->Project Settings->Graphics and under "Always Included Shaders" section Add "UI Particles Add", then build and run your project.