Sprites randomly display as horizontal lines


I am having trouble with the display of sprites ( see image attached ). In the script for the game object I change the sprite renderer by assigning a different sprite as the game progresses. The game will run fine but at a random place in the game the sprite will be displayed as per the attached image. If I delete all my sprites and reimport the png's then a different sprite will randomly show up wrong somewhere else in the game. When I look at the image in the editor the original appears fine.

Example code that assigns the sprite renderer: *actorCenter.GetComponent().sprite = gameController.getSprite(CurrentScene.stageCenterPosImageID.ToString());*.

If I build the game and run on a device I will see the same problem, game will run fine and then a random sprite will be displayed incorrectly with the horizontal lines.

I should also mention, I have tried loading the sprites from the resources folder and also an asset bundle for IOS format

Very confused any help will be appreciated.

Thanks for your time.



For anybody that see’s this later from google. I found this issue happens when the total size of all assets in either the resources folder or an asset bundle is over 4gb.

While I was testing I did not use any compression for images or the asset bundle resulting in a 5gb bundle file.

As soon as I reduced the resources file size by changing to an asset bundle and optimising sprite compression settings for each platform the issue no longer occurred.


I hope you have something like

actorCenter.GetComponent<SpriteRenderer>().sprite = gameController.getSprite(CurrentScene.stageCenterPosImageID.ToString());