- Home /
How do you have the editor compile script in background.
So my question is how do you have the editor compile while in the background(not focused). Right now I have a large project that takes a few seconds to compile, so when I save a script unity will only start compiling when I click into the editor again. Usually there is a second of it looking for changes, then it freezes to compile for 2-3 seconds. I have a good computer so there would be no impact on me if unity keeps checking for this while I am in visual studios.
I still haven't figured this out, but there are a few things I found that make it compile faster. Get rid of any warning messages that show about scripts(as the log function takes a while to complete, I was getting 48 warnings from a specific plugin the project was using), also getting rid of unused using references seemed to help maybe? I know the compiler usually gets rid of these, so maybe that step was taking some extra time.
I think @Warmedx$$anonymous$$ints is right. there is nothing really to do about this speed. And 2-3 seconds seems fine to me. Have the same issue since the project is getting large. Could be worse i guess :D
Answer by WarmedxMints · Feb 26, 2019 at 07:56 AM
There isn't really much you can do I believe. One option with a large project is if you have a section of code or namespace that will never change, compile it into a dll. Other than that, I don't believe there is a way to get Unity to compile in the background.
Answer by Lynkfox · Feb 24, 2019 at 11:43 PM
I'm not exactly sure of the answer to your question, but if your script is that large, consider breaking it up.
Make a master class that contains most of the methods you would use, then make a smaller script that inherits from that master class so you can use the methods. But that script only does one or two things. That way you only have to compile the smaller script, the master class being inherited from is already ready.
My general understanding of unity is if your script is that big, then you are probably doing things in it that would be better done with the various assets. You can script animation for instance, but there is also an animator. You can script all your camera movements, but there is also an asset that does great camera control, through the editor ( Cinemachine and it's free). Setting up a UI? Look into doozy or another UI asset.
Yes, scripts can do it all. Learning to use the tools already provided / available however will get you to a much better place as a unity developer.
It is not that there is a single large script. I think it's because the project is so large with many scripts that it takes a while to figure out which scripts to compile. Also maybe the first pause is from unity going through other checks before getting to the compiling part. I am a professional unity developer for over 8 years now. What I am doing is custom solutions for companies, so most of the pre-built resource are not specific enough for their needs, or are slower because they have to cover a larger use case. Though of course I do use ones like leantween or others, but that advice was not needed here.
fair enough. I misjudged the indication that it was one script, as opposed to many.