Help Troubleshooting: "Cannot generate 9 slice most likely because the size is too big."

Is there anyway to pin-point the code or image that is causing the error:

“Cannot generate 9 slice most likely because the size is too big.”

I have no idea how to fix this error as it doesn’t provide me with a source.

Please help.

Experiencing some unusual behavior:

  • If I delete all the objects in the scene and click run, I still get the error: “Cannot generate 9…”. However, if I delete all the objects, right click on the scene and select “reimport” then the error goes away.

Version 2019.2.4f

Update Log:

  • This error is not dependent on any scene, which leads me to believe there is a png or jpg with either a border or 9-slice enabled guilty of generating this error. It’s too big to full-fill the request (I don’t know why Unity wont tell me which asset it is, unless I’m wrong and it’s being generated through a script I didn’t create). Since I can’t manually search through thousands of assets and check if a border or 9-slice was enabled, I’ll have to write a scaper bot that finds and quarantines any png.meta file with the border or 9-slice function enabled.

Despite what the error message says, it’s actually an issue with Pixels Per Unit being too high on a small image.

After manually checking the hundreds of images in my game, I finally found the solution. For me, there was a small image (32px by 32px) with the Pixels Per Unit (PPU) set to 100. After changing this to 1, the error went away!

In my case, I just change a spriteRenderer gameobject’s drawmode from slice/tiled to simple.