Huge Speed Difference Between Editor and Build

Hi there!

When my game starts, it imports all characters from the file system, as the game supports custom characters. I do this by importing the textures of each character, and slicing it into sprites. It all works wonderfully.

However in a build, I can import ~150 characters in 4 seconds. But in the editor it takes about 15 - 20 seconds to do 14 characters. This makes testing things quite cumbersome!

I noticed earlier that if a build starts with V-Sync on, the import time is closer to the editor. But I’ve set V-Sync off in quality settings, so I’m not sure why the Editor would be forcing this on?

I was hoping someone had an idea of how to get the editor matching the build speed of asset creation. I understand there is a performance difference, but this seems far too high.

Thanks in advance for any help!

Well, with this little information, its very hard to say any advice, except: Good luck with your profiling.

No, seriously. Just start profiling the code. You probably won’t be able to use the internal Unity profiler for this, as its only really useful for profiling frames of rougly 20-1000ms length.

But a simple series of Debug.Log(Time.realTimeSinceStartup) all over the place should get you some insights where the time is spent.

Hey, thanks for the reply! So I actually found these in my search:

http://answers.unity3d.com/questions/920478/unity5-spritecreate-perfomance-issue-in-editor.html

Though I’m using the latest 4.6 version, so maybe the last one isn’t relevant. But it does seem to be choking on the Sprite.Create. (I create many, many sprites. Well in the hundreds.) However none of those posts seem to have found a solution.

I stagger the sprite creation over a number of frames, so it doesn’t hang the game, and my loading animation can play. And like I said, in a build it is extremely fast. 150 characters totaling well into the 1000s of frames loads in 4 seconds, but the editor gets seriously held up.

Is there anything I can do to speed up the Sprite.Create call?

Yes, you can file a bugreport with a small example project demonstrating the problem. None of your cites did this, but this would be the very first step when encountering a bug (and the big time difference is surely not intended…)