Hi there! We have a very big project and we are implementing protobuf for communication with an external app.
We have a system that download the proto client for your machine, download the definitions and generate the code necessary for that protos.
We are not pushing the generated code to our repo so we need to do that step at compilation time.
This work great when we are switching branches. However, when you open the project the first time since unity enters in Safe mode ( because the auto-generated code hasn’t been generated, so the classes that points to that code gives errors because the classes doesn’t exist yet) , it doesn’t compile so it doesn’t gives any callback.
So I have no way to detect that and generated the classes before compiles those assemblies.
Is any way to have a callback before the compilation or when entering safe mode or some way to overcome this?
I am using this code
[InitializeOnLoad]
public class ProtobufEditor : AssetPostprocessor
{
static ProtobufEditor()
{
CompilationPipeline.compilationStarted += OnProjectCompile;
CompilationPipeline.assemblyCompilationStarted += OnProjectCompile;
OnProjectCompile();
}