- Home /
2D sprite flickering if mipmap disabled - UPDATED
Hello, i'm working on a 2D game. I've built it on Android and tested on several devices. Everything works fine in almost all the cases, except on just one device where some sprite looks like it has been chopped in pieces and mixed together without any order. The final effect is obviously awful!
The Android version on that device is older but i've tried also on other devices with the same operating system version and everything looks fine.
The suspicious fact is that this bug only shows on png that i have drawn on my own, so maybe i need to set some property before to import them in Unity.
Anyway, all the png are already set to Sprite Mode: Single and Format: Truecolor.
Can anyone help, please?
UPDATE - The problem was about mipmaps, disabling them solved the problem. But now i have a strange flickering effect on some sprite borders... any idea?
UPDATE 2 - This is my gameobject update function:
void FixedUpdate ()
{
if (bh_rotating)
{
transform.Rotate(Vector3.forward * 12f);
bhDestroyDelay -= Time.deltaTime;
if (bhDestroyDelay <= 0)
main.DeleteAstro(this.gameObject, false);
}
if (beans)
{
amplitude = 0.8f;
frequency = 1.0f;
rigidbody2D.velocity = Vector3.right * 2;
transform.Rotate(Vector3.forward * 2.5f);
transform.position += amplitude * (Mathf.Sin(2 * Mathf.PI * frequency * Time.time) - Mathf.Sin(2 * Mathf.PI * frequency * (Time.time - Time.deltaTime))) * transform.up;
}
else
{
this.rigidbody2D.AddForce(-Vector2.right * 1 * Time.deltaTime * direction);
this.transform.Rotate(Vector3.forward * direction * 0.5f);
}
}
variables beans and bh_rotating start with false values, so in normal conditions the interesting part is the "else" statement
Thanks digzou, that solved the problem! :)
But now i have a strange flickering effect on sprites borders... any idea?
of course i use an update function to work on that game object, but what do you mean with "updating sprite"? changing the source image file? i'm not doing something like that
can you share the snippet of your update function where the gameobject is being updated? The flicker could be because of FPS drop or that the Z of the camera or the sprite is being changed.