So I’m probably going about this the wrong way but I’ve been trying to make a child class of AActor get data from a child class of UObject and have them somewhat synchronized. I did the following in my cpp file which works to make it so when I select an Item (the UObject Class) for the Pickup (the AActor class) it loads in all the data from the item’s CDO.
#if WITH_EDITOR
void APickup::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
FName PropertyName = (PropertyChangedEvent.Property != NULL) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
if (PropertyName == GET_MEMBER_NAME_CHECKED(APickup, StorableItem))
{
if (StorableItem.Get())
{
UStorableItem* CDO = Cast<UStorableItem>(StorableItem->GetDefaultObject());
Weight = CDO->Weight;
bStackable = CDO->bStackable;
StaticMesh->SetStaticMesh(CDO->StaticMesh);
}
}
}
#endif
However, if I then go into a StorableItem and change properties (like weight for instance) the pickup will still have the OLD property values from before I made the change which is the issue.
Am I going about this the wrong way or do I just need to add code to the item class to make it so when I update one of the variables it runs through a list of all the pickups in the asset browser and updates them as well?
Thanks,