- Home /
Is there a way to run a script when compilation fails?
Yeah so I've automatically created a class Generator that generates a ScriptableObject that can hold any seralizable value.
it will be regenerated automatically, when FieldTypes differ or are missing. But now I figured, if the prexisting FieldType doesn't exist in the Project compilation, it will throw an Error and renders me unable to regenerate the file (yeah, kinda retarded now, am I not?)
to make it short, is there a way to register a script to unity when compilation fails? like an automated repair script or sth? or could a compilation pipeline script help me? where would I start there?
Hi, just some pointers: search for usage of EditorApplication.update combined with the [InitializeOnLoad] attribute usage on an editor class. This is to get a callback at each Editor frame. After that, it's possible to check what the Editor is doing each frame with EditorApplication.IsCompiling and detect the end of the compilation!
Your answer
![](https://koobas.hobune.stream/wayback/20220612191221im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
My Javascript is not opening 0 Answers
WebGL compilation Error 2 Answers
Compilation failed because the compiler couldn't be executed. 1 Answer
Could not start compilation, Win32Exception 1 Answer
Need help with shader not working! 2 Answers