Unity Editor launches game much more slowly after 2nd time

Have a weird problem that has shown up recently, my game will launch fine if upon my first starting up Unity, but the 2nd time and subsequent times, it will take 5 to 10 times longer to launch. From what I can tell only when I close unity and restart it will the game launch as quick as it used to, but then again, only the first time.

Also, and maybe related, I have a bad bad lag between Mono and Unity, especially if I change a script. This lag seems around the same length of lag I am getting with the game launch.

One thing I notice is when I am in unity my ‘warnings’ are around a dozen, but when I go to Mono, change a script, press save and return to Unity, I cannot touch anything for a while(that lag mentioned above), and when it does return to where I can do things, the warnings shoot up to 4x that, with many warnings I swear I have not seen before but in scripts that have been around for a while(mostly private variables that are not given a value until it hits a if).

Any ideas?

Greetings Primemover,

I’ve been using Unity for about a year now, and the behaviour you’re describing is normal, as far as I can tell.

In order for the editor to maintain a proper handle on things, it’s got to be 100% sure that the scripts and such which are used at the “Play” (testing the game) launch, are not full of errors or it’ll crash.

Thus, when you make a change to a script in Mono (And for me too, and I believe, everyone else) the Unity editor actually reviews the changes and (Perhaps all other scripts currently being used in the scene) and then let’s you know if there’s errors or warnings in the Console area. (During this time, look down at the very bottom right of the corner of the editor, and you’ll see there is moving wheel/progress kind of indicator, showing that the editor is busy scanning your scripts and putting the input into the Console, if there’s anything it needs to tell you about…

So, to be honest, it’s really annoying, when you’re simply changing a value to tweak it, and test it’s performance in-game, but I believe that this is actually normal Unity engine behaviour…

** Also, I’ve noticed that Unity doesn’t actually start performing these script checks, until you change the “focus” from Mono, back to the Unity Engine. (So, you can change a script and save it, but Unity doesn’t pick this up, until you switch from Mono back to the Unity engine. So, you could change a script, save it, walk away from your computer, and then return 15 minutes later, then click on the Unity window, and only “then” will it check the scripts, and you’ll experience the delay while it does the checks… really annoying, I know… )

On my last (paid! Hurray!) project, I was totally sick of making adjustments to scripts, 'cause I knew I’d have to wait, after every little tweak and save… just to try it out in testing and see if I had got it right.

(Unity Community! Please correct me if I’m a little off/wrong in this functionality. Actually I’d LOVE (& pay for the possibility, too) to not have to wait every time that I change a script and save it…

Thanks for the responses guys, I figured out what was causing the delay, I had a script that had a public class that had [Serializable] on it, once I took that out everything went back to normal.

I an attempt to save game-state data in a binary format, I created a serializable non-monobehavior based public class that mimicked a regular monobehavior based class, had the same properties and all that, so I can serialize them in a binary format for saving the game-state. I am obviously using it incorrectly though I was able to get my data to save, so it’s kind of disappointing, I have to read up more on how to do this correctly.

FURTHER INFO:
It wasn’t actually the existence of the serialized class itself, it’s that I was making a new instance of it every time I created a new gameobject item. Once I take out that instance creation, it’s all good.