So i have a variable in cpp which i edit in blue print

how would i make it so that when i change the pick up mesh in the editor the materials array dynamically updates to the meshes default materials like how the static mesh component works

So i have a variable in cpp which i edit in blue print
Override PostEditChangeProperty().
AActor::PostEditChangeProperty | Unreal Engine 5.2 Documentation
Example for changing a class property enum called “_type” in a class called ConfigurableActor.
#if WITH_EDITOR
/**
* Called when a property on this object has been modified externally.
* NOTE: requires #if WITH_EDITOR or development/shipping binaries will not compile.
*/
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& propertyChangedEvent) override;
#endif
#if WITH_EDITOR
void AConfigurableActor::PostEditChangeProperty(FPropertyChangedEvent& propertyChangedEvent)
{
// get the property name from the property changed event
const FName changedPropertyName = (propertyChangedEvent.Property ? propertyChangedEvent.MemberProperty->GetFName() : NAME_None);
// "type" property changed
if (changedPropertyName == GET_MEMBER_NAME_CHECKED(AConfigurableActor, _type))
{
ConfigureComponents(); // custom function where actor is configured
}
Super::PostEditChangeProperty(propertyChangedEvent);
}
#endif
thanks that works perfectly
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.