How to update the reflected data on the Editor?

Long story short: I’m integrating C++ Hot Reload in Ly: https://youtu.be/VrVL2aTEukE
Expectation: update the Editor reflected data and see the new data on the Inspector

I’m wondering how to update dynamically the data reflected in the Editor. Let’s suppose I have the following code:

//
// Compiled version - v0
//
void T::Reflect(AZ::ReflectContext* reflection)
{
    AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection);
    if (serializeContext)
    {
        serializeContext->Class<FlyCameraInputComponent, AZ::Component>()
            ->Version(1)
            ->Field("My Var", &FlyCameraInputComponent::m_myVar);
    }
}

Then because I changed my class now I have the following code:

//
// New version compiled on runtime - v1
//
void T::Reflect(AZ::ReflectContext* reflection)
{
    AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection);
    if (serializeContext)
    {
        serializeContext->Class<FlyCameraInputComponent, AZ::Component>()
            ->Version(2)    // ???
            ->Field("Updated Variable", &FlyCameraInputComponent::m_myVar);
            ->Field("My Other new var", &FlyCameraInputComponent::m_myOtherNewVar);
    }
}
  1. How do I make Ly and the Editor aware of my changes?
  2. Is that possible just calling again T::CreateDescriptor?
  3. Do I need to have the same GUID? Can be different? It is checked somewhere?

Thanks for the support!

1 Like