0
\$\begingroup\$

The sprite renderer can render the sprite correctly in the Unity Play mode, but when I build the game, it can't render the sprite correctly, and there are stripes on the sprite.

Here are the screenshots(on the top are sprites rendered in the Unity embedded play mode(expected), at the bottom are sprites rendered in the Unity build mode):

sprite rendered in Unity embedded play mode sprite rendered in Unity embedded play mode

sprite rendered in Unity Build mode sprite rendered in Unity Build mode

I've tried to lower the resolution ratio of the image. For example, 1000x1000 down to 200x200. Then I replace the high resolution one and reduce the Pixels Per Unit to match. It can fix the problem, but only works for some of the sprites without animation. And for the sprite with animation, when I disable the animator, it looks correct, but when I enable the animator, the problem happens in some of the frames of the animation, so the animation looks weird.

\$\endgroup\$
6
  • \$\begingroup\$ This looks like what you get when code tries to read an image with the wrong stride (for example, treating a 64 pixel wide image as though it were 32 pixels wide, so each row of the output is made of the two halves of one row of input). Nothing you do in the Unity editor should cause this, so suspect #1 is that your Unity installation itself is corrupted somehow. I'd recommend uninstalling, and installing an updated LTS version. Be sure to also describe in your question what platform you're building for, and what build settings you're using. \$\endgroup\$
    – DMGregory
    Jul 31 at 11:14
  • \$\begingroup\$ I'm trying to build the Windows x86-64 version and use the Default Compression Method. By the way, I've used 2019.4.40f1c1 and 2019.4.36f1c1 to build this, and all of these have the same issue. \$\endgroup\$
    – vinkle
    Jul 31 at 11:22
  • \$\begingroup\$ If it's persisting after a re-install, my next step would be to make a minimal project demonstrating the issue in the most up to date LTS version and report it to Unity as a bug. I've never been able to reproduce anything like this when building for Windows. \$\endgroup\$
    – DMGregory
    Jul 31 at 11:32
  • \$\begingroup\$ Updating your graphics card drivers is also worth a try. \$\endgroup\$
    – DMGregory
    Jul 31 at 14:50
  • \$\begingroup\$ Thanks, it fixes when I level up the Unity Editor to 2021.3.6f1c1. And It is weird when I build a new 2019.4.40f1c1 demo and create animation with the same art resources to repeat the bug, the bug just disappeared. \$\endgroup\$
    – vinkle
    Jul 31 at 15:25

0

You must log in to answer this question.

Browse other questions tagged .