1
\$\begingroup\$

I'm creating a simple 2d game for android, with normal sprites and animations. The problem is that when I open the game on my smartphone (Samsung galaxy trend plus), The sprites are rendered this way:

Bug

Of course, this is not what should happen. Moreover, within the Unity editor everything works flawlessly. My settings for the export are:

  • Texture compressions: ETC2 (GLES 3.0) - Tested also with "Don't override"
  • Player settings
    • Default orientation: landscape
    • Use 32 bit display buffer: unchecked - tried also with this option checked
    • Rendering path: forward - tried also with Legacy Deferred
    • Static batching/Dynamic batching: both checked
  • Camera settings
    • Clear flags: Solid color - tried also skybox

I don't have any other scene, and this one has only one camera (I saw some topics where people were having problems because they had two or more cameras). The sprites are all .png images with transparence, except for the background, that has no transparence, but is lagging. There are three sprites which are animated using the spritesheet, but they're terribly lagging, and almost can't be seen in this screenshot. I really can't understand why, I'll continue to try, waiting for your answers. Thank you in advance!

EDIT: If in the player settings the orientation is set to auto-rotate and the device is in portrait, all the sprites works perfectly!!! The problem is that my game is meant for landscape...

\$\endgroup\$
1
\$\begingroup\$

I just received an answer from the Unity Answers forum. It pointed out that I should've tried to disable the mipmaps on the sprites. After disabling them everything worked flawlessly.

\$\endgroup\$
0
\$\begingroup\$

I recently encountered this problem 2nd time. I think it is a bug of Unity. Well, surprisingly the solution is out of the box. Solution is also like bug, silly bug silly solution.

Right now your camera is definitely at Z:-10 move it to -1.... something and change Clipping Planes to Near: 0.3 Far 3.

Camera settings

May be this exact solution may not resolve your problem, but solution does exist in this. Play with it if this exact settings not work.

NOTE: I hope your Order in Layers are properly set as the should be.

\$\endgroup\$
  • \$\begingroup\$ Thank you really much for such an immediate answer! I tried this exact solution, but it doesn't work for me. I'll try changing the values a little. I haven't touched the Order in Layer at all, but the background has a 'z' position of 2 so it should not be drawn above the other gameObjects, and the other objects are not overlaying. \$\endgroup\$ – Andrea Dragotta Feb 1 '16 at 15:41
  • \$\begingroup\$ Don't rely on Z if you are developing 2D. Consider Order in Layers. 0 is most behind then 1 is in front of 0 and so on... \$\endgroup\$ – Hamza Hasan Feb 1 '16 at 15:47
  • \$\begingroup\$ And this solution did work for me when all the objects's Z is at 0 and sorted them through Order in Layers \$\endgroup\$ – Hamza Hasan Feb 1 '16 at 15:48
  • \$\begingroup\$ I've just changed all the z value to 0 (there was only the background set), and to change the Order in Layers. Now the static images are working pretty well, but the animation and the background (which is static) not \$\endgroup\$ – Andrea Dragotta Feb 1 '16 at 16:37
  • \$\begingroup\$ I've changed the Order in Layer, so now there are no elements that has the same Order in Layer value of an other one. Still, the situation looks like this \$\endgroup\$ – Andrea Dragotta Feb 1 '16 at 16:54
0
\$\begingroup\$

I had similar issue, then using the ordering of layers and changing the z value of the sprites to make them nearer or farther from the camera, it helped me.

Try making the objects closer to camera which as hidden or not seen clearly.

Hope this works.

Thanks

\$\endgroup\$
-1
\$\begingroup\$

Setting camera's clearflags to solid color solved this for me.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.