Cubase 12 gui wipes loaded params

Hi all ,
I have built a synthesizer using JUCE. I have built a few plugins before but it’s all still a bit unfamiliar. I am testing the plugin inside cubase. Is there a way to debug inside that application ? I can debug using xcode and the standalone application but once I am inside cubase its all a mystery.

I have set my plugin up to save parameters in the gui. I can save and load presets fine. Cubase has a button to open the gui. If the gui is closed and reopened it sounds like without any sliders moving the plugin resets all the params to defaults.

Do I need to retrieve the state of the gui knob positions in createEditor() ?

Maybe this bit of code is where I am doing something wrong ?


AudioProcessorEditor* waylosynth2::createEditor()
{
    return new waylosynth2AudioProcessorEditor (*this, parameters);
}

//==============================================================================
void waylosynth2::getStateInformation (MemoryBlock& destData)
{
    // You should use this method to store your parameters in the memory block.
    // You could do that either as raw data, or use the XML or ValueTree classes
    // as intermediaries to make it easy to save and load complex data.
    auto state = parameters.copyState();
    std::unique_ptr<juce::XmlElement> xml (state.createXml());
    copyXmlToBinary (*xml, destData);
}

void waylosynth2::setStateInformation (const void* data, int sizeInBytes) 
{
    // You should use this method to restore your parameters from this memory block,
    // whose contents will have been created by the getStateInformation() call.
    std::unique_ptr<juce::XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes));

    if (xmlState.get() != nullptr)
        if (xmlState->hasTagName (parameters.state.getType()))
            parameters.replaceState (juce::ValueTree::fromXml (*xmlState));
}

Perhaps this is non standard using reset in the editors constructor?

attackAttachment.reset(new AudioProcessorValueTreeState::SliderAttachment(valueTreeState, "attack", attackKnob));

Any suggestions here ? Perhaps I haven’t shared enough code .
Thanks in advance Sean

Are parameters and valueTreeState the same object? It seems like they should be.