- Home /
Detect if Unity is building/compiling the project/scene
My team has some licensed software that we would like to include in a Unity project. We've developed license verification code that has worked for us for a few years on mobile. When developing with our software, we would like to check the license to verify that it is valid, but when the Unity app is already built and running for the consumer, we would like to bypass the license verification.
Can we:
Detect if Unity is currently building or compiling our project?
If true, verify the license
If false, bypass the license verification
If the license verification fails we want to throw an exception to alert the developer.
Hello, to detect if Unity is compiling you can use EditorApplication.isCompiling.
About build process, there is many PostSomething* methods to interact.
Concerning your license, I can't help you.
Oh I didn't know about the EditorApplication class. That should do the trick, thanks! Not sure what you mean by the PostSomething methods. Can you clarify?
Here you got an attribute to invoke a callback rightafter building:
https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html
Answer by AnomalusUndrdog · May 10, 2019 at 11:59 AM
A glance at the documentation reveals these two: BuildPipeline.isBuildingPlayer, and EditorApplication.isCompiling.