IDetailLayoutBuilder doesn't contain CurrentCustomizationClass when passed to an event

so I have DetailCustomizations function and IDetailLayoutBuilder it works perfectly
I can modify the UI within CustomizeDetails

but when I pass a reference of IDetailLayoutBuilder to an event, IDetailLayoutBuilder no longer contain information of CurrentCustomizationClass so it fails to customize the UI and crashs

demo code (this not a real code so excuse me if there’s any typo) let’s use SetOnPropertyValueChanged as an example (it could be anyother event)

CustomizeDetails(IDetailLayoutBuilder& detailBuilder)
myHandle->SetOnPropertyValueChanged(FSimpleDelegate::CreateSP(this,&myClass::OnNumElementChanged, &detailBuilder));

Now this details Builder when it hit it no longer contain CurrentCustomizationClass so when i try something like

void myClass::OnNumElementChanged(IDetailLayoutBuilder* myDetailLayoutBuilder)
myDetailLayoutBuilder->GetProperty(GET_MEMBER_NAME_CHECKED()); //fails
myDetailLayoutBuilder->EditDefaultProperty(myhandle)->CustomWidget … //again fails

I want the custom modification to happen whenever this event is triggered
but the object in CustomizeDetails is not the same as the object in OnNumElementChanged
the first one has CurrentCustomizationClass and the second one doesn’t

how can i make the code in OnNumElementChanged work

did you have ever tried to use Rider {JetBrain} it seem that you have a syntax error ? i cant really help, but try to search ctrl+f and replace, to see if you have missed a “Detail than detail” word into the code, and then try a tiny debbug.
Hope this idea of research can help, if not good luck !

1 Like

First thanks for answering
I already mentioned this is not a real code which could contain typo, so there’s no need to focus in the syntax. this is just to illustrate where the issue I have is located

anyway Syntax error leads to compiler error which is not the case here
the issue is that the IDetailLayoutBuilder object contain CurrentCustomizationClass and when it’s passed in the delegate, this object is destroyed and it becomes null and it no longer contain CurrentCustomizationClass which leads to nullptr

1 Like