- Home /
 
2d game performance is bad in mobile, but giving 80 to 130 fps in pc, its physics game, help plz
I made a game in unity4.3 built in 2d ,game has lots of 2d rocks with rigidbody and polygon colliders, the game is working smooth in pc and mobile with upto 1 gb ram, but its not working smooth with my mobile i have but its playing all heavy games from playstore, i dont no what should i do,
i am using built in diffuse shader in graphics setting. ...quality setting is faster
need help!
Answer by Nabeel Saleem · Apr 21, 2014 at 09:15 AM
i found a shader from **madfinger** it reduce my draw calls,
 // Unlit shader. Simplest possible textured shader.
 // - SUPPORTS lightmap
 // - no lighting
 // - no per-material color
 
 Shader "MADFINGER/Environment/Unlit (Supports Lightmap)" {
 Properties {
     _MainTex ("Base (RGB)", 2D) = "white" {}
     _Color ("HACK: temporary to fix lightmap bouncing light (will be fixed in RC1)", Color) = (1,1,1,1)
 }
 
 SubShader {
     Tags { "RenderType"="Opaque" }
     LOD 100
     
     // Non-lightmapped
     Pass {
         Tags { "LightMode" = "Vertex" }
         Lighting Off
         SetTexture [_MainTex] { combine texture } 
     }
     
     // Lightmapped, encoded as dLDR
     Pass {
         Tags { "LightMode" = "VertexLM" }
 
         Lighting Off
         BindChannels {
             Bind "Vertex", vertex
             Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
             Bind "texcoord", texcoord1 // main uses 1st uv
         }
         
         SetTexture [unity_Lightmap] {
             matrix [unity_LightmapMatrix]
             combine texture
         }
         SetTexture [_MainTex] {
             combine texture * previous DOUBLE, texture * primary
         }
     }
     
     // Lightmapped, encoded as RGBM
     Pass {
         Tags { "LightMode" = "VertexLMRGBM" }
         
         Lighting Off
         BindChannels {
             Bind "Vertex", vertex
             Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
             Bind "texcoord", texcoord1 // main uses 1st uv
         }
         
         SetTexture [unity_Lightmap] {
             matrix [unity_LightmapMatrix]
             combine texture * texture alpha DOUBLE
         }
         SetTexture [_MainTex] {
             combine texture * previous QUAD, texture * primary
         }
     }    
     
 
 }
 }
 
 
 
 
              Answer by ozku · Jan 16, 2014 at 12:24 PM
Diffuse shader is different for mobile and desktop. You can switch it by going on your material, changing shader from diffuse to mobile -> diffuse.
if you already have mobile shader chosen, you should make your texture smaller ex. 200x200 (inspector->max size) or with image editing software.
There are multiple other things you should do to optimize your game and you can find those googling your problem.
Your answer