Unity freezing after update when trying to use sprites.
After updating Unity to 5.3.5 (from 4.something) a project that worked fine consistently freezes Unity. After scouring scripts I found it had something to do with how images are being loaded and causes Unity to unrecoverably freeze when:
---- running the game, but only if moving and after a couple seconds with no slowing transition from 60 fps to full program freeze
I believe this is related to the parallax script repositioning sprites on screen. It is not an issue with the script itself though as commenting out the entire thing did not address the other issues below.
in the editor --- in scene view
There are several sprite layers used with the parallax described above. There is an instance of all layers on screen both in editor and in game by default. But if I zoom the scene view out it freezes immediately. Presumably when one of the other panels (there are 4 of each to facilitate looping on 2 axes) of one of the parallax effect layers enters the view.
--- in Inspector
This one seems less consistent, but selecting a specific png for a sprite will also instantly freeze Unity. Deleting the .png.meta file seemed to temporarily resolve this, but inconsistently.
--- recreating objects from scratch
I tried deleting all the parallax objects in the scene and recreating them from scratch. The first one worked fine, but Unity froze the instant I tried to duplicate it.
--- on import
I completely wiped these files from their directory in assets and tried re-importing them. Trying to do this by copying the files to the directory froze Unity. Dragging the files individually into the project assets window 1 at a time worked, but slowly. Even then, once I start adding them to the sprite objects again Unity instantly freezes after a variable number of selections. Ex: select the sprite for obj0, obj1, obj2 and it loads fine, then the instant I select the same sprite image for obj3 it freezes.
====================================================== Other notes: - This only happens with the parallax sprites. There are other objects in the scene using different images of the same size. Unity and the game run perfectly fine with the parallax sprites removed.
The issue is not at all consistent on which png it occurs with. Setting all objects to use the same png that starts on the screen to start does not change the behavior.
The images are 2000x2000, the largest .png is a bit over 1 meg, the other two are ~0.5 megs and ~0.15 megs.
There are other images of the same format and size being used in the scene on 3D objects instead of sprites with no issue.
At the times of the freezes nowhere near all system memory has been in use (16 gb), on the most recent re-import attempt it showed at 36% in task manager.
I am relatively new to Unity, but generally baffled since this worked in editor and while running flawlessly before updating Unity.
Your answer
Follow this Question
Related Questions
put more than one camera 0 Answers
my game is freezing! 0 Answers
Unity freezes when I run this and I have no idea why, please help 0 Answers
While loop freeze 0 Answers
Editor freezes after 'killing' an enemy but not every time 1 Answer