Sprite Renderer Issues in Build (b21)

I had made another topic about instantiation freezing issues and sprite issues. The instantiation issues are fixed, and so I thought it would be better to put this issue in its own topic and see if anyone else has any ideas about what’s going on.

Here’s an image from a platformer (using asset store art for prototyping):

When I update an image in the UI by changing its sprite through code (using the Recompute function here):

public sealed class HealthDisplay : MonoBehaviour
{
    [SerializeField] private Sprite[] sprites;
    private Image[] hearts;

    private void Awake()
    {
        hearts = GetComponentsInChildren<Image>();
    }

    public void Recompute(int health)
    {
        for (int i = 0; i < hearts.Length; i++)
        {
            health = Mathf.Max(health, 0);

            if (health >= 4)
            {
                hearts[i].sprite = sprites[4];
                health -= 4;
                continue;
            }

            hearts[i].sprite = sprites[health];
            health = 0;
        }
    }
}

I end up with the tree sprite becoming enlarged in the corner of the screen:

This flashes for a brief moment. It almost seems like the images are trying to move from the corner to their actual positions.

The code above is updating heart sprites to show how much remaining health the character has. Changing the sprites is specifically what makes this happen.

The interesting part is that this only happens in builds, never in the Unity editor.

It happens both in debug and release builds on my Mac (El Capitan, 64 bit) as well as on the build I sent my friend with Windows 7.

What’s going on here?

I have found the source, I believe. It’s the experimental “graphics jobs” option in the player settings. Turning that off seems to have fixed it (as well as a massive Camera.render culling spike that was going on from it.)

So really this option is so far broken, maybe can send them a bug report and may improve on the issue.?

Please submit a bug-report for that, otherwise it might not get fixed.

Once I can set up a smaller project for testing today, I sure will.

1 Like