- Home /
Problem rendering particles in ios
Hi,
I have a problem rendering a particle system in ios. While it runs fine in the editor, it doesn't look the same while I run the game on an ipad mini. I tried different shaders but nothing seems to work. Here follows the code and I have also attached two screenshots to show the problem.
Many thanks for the help, I hope my question is not too newbie.
Thanks Ioannis
void Awake () {
GameObject parent = new GameObject ("test");
ParticleSystem particlesystem = parent.AddComponent<ParticleSystem> ();
ParticleSystem.Particle[] p = new ParticleSystem.Particle[1];
p [0].size = 2;
p [0].position = new Vector3 (0, 10, 0);
p [0].color = Color.green;
ParticleSystemRenderer pr = (ParticleSystemRenderer)particlesystem.renderer;
pr.renderMode = ParticleSystemRenderMode.Billboard;
pr.sortingOrder = 1;
particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/Additive");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/Additive Culled");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/Alpha Blended");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/Multiply");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/Multiply Culled");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Particles/VertexLit Blended");
//particlesystem.renderer.material.shader = Shader.Find ("Mobile/Transparent/Vertex Color");
//particlesystem.renderer.material.shader = Shader.Find ("Sprites/Default");
particlesystem.SetParticles (p, 1);
particlesystem.startSpeed = 0;
particlesystem.startSize = 0;
particlesystem.Emit (1);
particlesystem.Pause ();
}
Answer by Owen-Reynolds · Oct 10, 2014 at 04:26 PM
That solid pink color is the standard "bad material" material.
Wondering if it isn't just a path problem, or a resourse loading issue? Shader.Find ("Mobile/Particles/Additive");
on line 13 may be returning null on iOS.
Do you need to build the material in game? Can't have it premade?
If I have to, I usually just make slots in the script and load the elements (shaders, textures) into the Inspector. Have the code read them from there.
$$anonymous$$any thanks, you are right, it doesn't find the shader. Just by adding the particle system component in the inspector, using default shader, and adding particles in code, it works!
Hello ioannis.f, please can you tell me exact steps how you fixed it ? Currently I have same problem and I dont know what I should do. Please help me. Thank you