- Home /
Sprite Becoming Blurry
Hello, I know this gets asked quite a bit, but I still have not been able to find a solution to this problem.
I have a sprite (not a power of 2). Using the 4.6 Image, I add the sprite to the image and it looks great:
In my script, I am messing with these images to create a pseudo-inventory system. However, when I switch the sprite back to the SAME image, the image becomes blurry (The top two images on the left):
I have tried setting the sprite as generate mip maps vs not generate mip maps, filter mode point vs bi-linear, format true colour vs 16 bit vs compressed, none of it is happening. No matter what combination of those three settings I use, the image is still blurry when swapped out via code.
The image is 1024 x 1024 so it is a power of 2, the max size is set to 1024.
I am at a loss for how to solve this problem.
The code I am using to swap the image is a simple image.sprite = (sprite loaded from resource)
public void AddItem(int itemID)
{
if(inventoryItem[itemID] != null)
{
Debug.Log ("Item exists!");
for(int i = 0; i < inventoryOpen.Length; i++)
{
if(inventoryOpen[i] == true)
{
inventoryOpen[i] = false;
inventorySlots[i].sprite = inventoryImages[itemID];
inventoryItem[i] = itemID;
Debug.Log ("Added item! Slot: " + i + " Slot Name? " + inventorySlots[i].name + " Item ID: " + itemID);
break;
}
}
}
}
I really appreciate any help or thoughts anyone has on this problem.
Switching to point mode definitely causes pixels to be sharper. I'm not sure exactly where your problem is (which sprite are you talking about?), but that seems to be the most likely cause of your problem.
The sprites that are beco$$anonymous$$g blurry are the ones that are individual items slots. Each of those slots are individual sprites. I did try point mode, but that didn't help at all. It is a 50/50 problem when put on other computers, so I think it really is just unity being odd.
Answer by SirBoboHobo · Apr 07, 2015 at 12:15 PM
-Make sure your image max size when you import it is big enough -Try changing filter modes -Untick Generate Mip Maps -Change the Texture Type to Advanced and change some properties until you get the result you want -lots of time this happens to me too, after re-importing a few times it looks okay.
Switching around through all of the settings still hasn't fixed the problem on my personal computer, however its 50/50 with it happening on another computer. I think I'm just going to chalk this one up to weirdness?
Answer by mathcuber · Apr 11, 2017 at 07:19 AM
I had the same issue in my game. I'm not sure why everyone is saying to not use generate mip maps, but clicking it helped the resolution a lot. I also checked tri-linear.