Midi output to process block but does not record in fl studio

I have successfully used the on-screen keyboard within my plugin to insert midi into the incoming buffer in the process block which I verified by examining the contents of the buffer after inserting.

I loaded my plugin as a synth in fl studio, tried recording notes and nothing is recorded.

Despite what I’ve read about midi difficulty in juce, I have hope because I look at the plugin “scaler 2” which seems to be calling a keyboardcomponent of sorts, which is outputting to fl studio without the use of any external midi keyboard. Granted, I don’t know if they are using juce.

Does anyone have experience with this they can help with?

My code is basically just the midimessagedata tutorial with this in the process block:

keyboardState.processNextMidiBuffer (midiMessages,
                                             0, buffer.getNumSamples(),

For future readers, I was using an audio unit. Apparently audio units (.au) do not output midi. You have to use vst3. And I also didn’t have “midi output” selected under the app settings in projucer which I’m sure wasn’t helping either.