Hello, developers.
I am trying to create a detail customization for a class. I was having great success up to a specific point - namely I am trying to create a new array handle and set its child handles’ values with some pasted information. The action takes place inside of a Paste delegated method for a slate UI element.
So, I am able to add a new IPropertyHandle inside of the IPropertyHandleArray, set its value here:
SecondaryTasksHandle->AddItem();
UTalkTask* TalkTask = NewObject<UTalkTask>(Outer.Tasks[Element]);
SecondaryTasksHandle->GetNumElements(NumberOfExistingSecTasks);
SecondaryTasksHandle->GetElement(NumberOfExistingSecTasks - 1)->SetValueFromFormattedString(TalkTask->GetFName().ToString());
The problem comes when I try to access the child handles of the IPropertyHandle element that I have just created like so:
for (uint32 i = 0; i < NumberOfExistingSecTasks; i++) {
if (TSharedPtr<IPropertyHandle> SecTaskHandle = SecondaryTasksHandle->GetElement(i))
{
TSharedPtr<FJsonObject> JsonSecondaryTaskObject = SecondaryTasksArray*->AsObject();
void * VoidSecTask = nullptr;
SecTaskHandle->GetValueData(VoidSecTask);
if ((UTalkTask*)VoidSecTask != nullptr) {
if (TSharedPtr<IPropertyHandle> TalkTask_SoundCue_Handle = SecTaskHandle->GetChildHandle(FName("SoundCue"))) {
TalkTask_SoundCue_Handle->SetValueFromFormattedString(JsonSecondaryTaskObject->GetStringField("TalkTask_SoundCue"));
}
So debugging the last code I have come to the conclusion that “SecTaskHandle” does not have any children, which is this line:
if (TSharedPtr<IPropertyHandle> TalkTask_SoundCue_Handle = SecTaskHandle->GetChildHandle(FName("SoundCue")))
My detail customization actually IS displaying properly and the properties are modifiable. It is just that I cannot set the child properties of my newly created handle/object.
I’ve been stuck with this for a lot of time. I have had people debug my code for me, too. I have been writing into discord groups as well. I would really love for somebody with experience with this to come tell me what I might be missing.
Happy Holidays! - Kris