Is Conditional Roslyn Source Generation Implemented?

Hi all,

I’ve recently been working with Roslyn source generation within Unity and have got some nice netcode source generation working :slight_smile: I’d like to know whether it is possible to have source generator DLLs run only when a constraint is specified or better yet, pass something to the source generator itself for it to decide what to generate.

My use case is that I want only the client code generated in the client build, server code on the server build and both in the editor (or in a client-server build).

Ideally this would work from the ‘Define Constraints’ array exposed in the inspector view for the DLL in editor itself.

Thanks in advance!