- Home /
Particle systems affecting performance in build.
After several long and frustrating hours I have discovered that for some reasons the particle systems that I have included in my game are causing the game to run really slow. However this is only happening when I build the game. When it is played through the editor it runs perfectly but as soon as the game is built it will run very slowly.
If there are any specific build settings or anything I may have overlooked that might help, it would be great if anyone could help me out at all.
Also in case this is some how effecting this, this is the code for the custom shader I am using for my particles.
Shader "Custom/SelfIlluminatedTransparent" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Illum ("Illumin (A)", 2D) = "white" {}
_EmissionLM ("Emission (Lightmapper)", Float) = 0
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _Illum;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_Illum;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
fixed4 c = tex * _Color;
o.Albedo = c.rgb;
o.Emission = c.rgb * UNITY_SAMPLE_1CHANNEL(_Illum, IN.uv_Illum);
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
I cut them down by half and it did make a difference, however due to the fact that they have to cover a very large space I cannot turn them down too much without them effectively beco$$anonymous$$g pointless. And my main concern was more that it runs fine inside the editor and it is only once built that performance becomes an issue.
Well, at least we know that particle count is the problem. How large is the space? How many particles?
The particle box emitter is 95 along both x and z and 5 along y. I have a sort of foggy cloud effect with a max of 150 particles and a dust effect with a max of 500. I know the dust particle count may seem fairly excessive, but it was previously 1000 and still ran fine within the editor.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Unity to android (game very laggy) 1 Answer
Inventory System (Specific question) -1 Answers
Massive performance drop Windows Store App 0 Answers
UpdateParticle system should not happen on disabled GO 4 Answers