How to get SObjectPropertyEntryBox to simply display selected static mesh name

Within a plugin I am creating I need to select as static mesh to spawn in the viewport. I have had difficulties in getting to use the details panel customisation methods due to lack of proper documentation and incomplete tutorials that all seem to be missing some important aspect to get a basic simple details panel customisation plugin up and running. Not too bad, I can never the less use what I can to at least get an inferior plugin interface up and running, but have one annoying aspect.

As in a previous question I posted

I asked about how to get a slate widget called SObjectPropertyEntryBox to display the selected static mesh name in the provided dropdown button

the widget appears as this.


and my latest code attempt snippet

		.OnObjectChanged(this, &object_iteration_panel_toolkit::on_static_mesh_changed)

void on_static_mesh_changed(const FAssetData &static_mesh){
 static_mesh_fullname = static_mesh.GetFullName();

I thought it would be inbuilt into this widget that once a selection was made, the selected static mesh name would be reflected by updating the text in the drop down combo button. But it is not, even though the selected mesh information does get passed to the binding function on_static_mesh_changed where I can assign and use it.

Does anyone know if I am missing something in the on_static_mesh_changed function that needs to be there like a hidden variable that needs to be reassigned or updated for the selected static mesh to be reflected in the widget button. Or is this how this is supposed to behave? There are no examples or documentation I can find in using this slate widget, and I only came across this by accident.

This is quite important if nothing other than confirming that a static mesh has been selected to be used.

Much appreciate any help in advance.

It took me a while to figure it out, but there are two ways to use SObjectPropertyEntryBox.
1: Use with PropertyHandle.
2: Use with ObjectPath.

1st method is pretty straightforward if you are actually modifying a property, like when you are implementing IPropertyTypeCustomization. But if you are not modifying a property, for example adding a context menu in a content browser, you don’t have access to PropertyHandle. Then you have to take the 2nd approach.

For 2nd approach you have to set the ObjectPath when you are creating the SObjectPropertyEntryBox.

TSharedRef<SObjectPropertyEntryBox>  ObjectPropertyEntryBox = SNew(SObjectPropertyEntryBox)

And because you can’t modify the ObjectPath after initialization, you have to pass in a function that returns the path, which should change according to the OnObjectChanged_Static event. So something like this:

void FMyTest::OnStaticMeshSelected(const FAssetData& AssetData)
	s_AssetData = AssetData;

FString FMyTest::GetPath()
	if (s_AssetData.IsValid())
		return s_AssetData.ObjectPath.ToString();
	return "";