Prefabricator - Open Source Prefab Plugin

I have recently found some spare time and got back to the project where I needed this functionality. I have modified [USER=“28980”]Ali Akbar[/USER]'s code in such a way that it now preserves the reference to the actors inside the prefab. Here is pretty much what I did:

  • I modified FPrefabricatorPropertyAssetMapping structure to store ItemID for the referenced actor (the ID is obtained from UPrefabricatorAssetUserData)
  • I store this ItemID inside UPrefabricatorProperty::SaveReferencedAssetValues()
  • I modified method FPrefabTools::LoadStateFromPrefabAsset such that it first spawns all the actors as placeholders and only restores their properties after all are spawned.
  • I take the list of spawned actors and forward it all the way to UPrefabricatorProperty::LoadReferencedAssetValues(TArray<AActor*> ChildActors)
  • Inside this method, I use the previously stored ItemID to identify the correct actor and change the ReferencedPath accordingly.

I am willing to share the code if anyone is interested (and if Ali agrees), but I have not yet tested it properly so I may have broken something else along the way.