Create Prefabs in Unreal Engine 4
Website: https://prefabricator.dev
Prefabricator - Prefab plugin for Unreal Engine 4 https://prefabricator.dev
License: MIT License
Create Prefabs in Unreal Engine 4
Website: https://prefabricator.dev
Hi there,
I can't use a prefab within a child actor.
If I assign a prefab to a child actor the editor crashes with the following log:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000358
UnrealEditor_PrefabricatorRuntime!TConstSetBitIterator::TConstSetBitIterator() [D:\RocketSync\5.1.0-23058290+++UE5+Release-5.1\Working\Engine\Source\Runtime\Core\Public\Containers\BitArray.h:1781]
UnrealEditor_PrefabricatorRuntime!FPrefabTools::LoadStateFromPrefabAsset() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:898]
UnrealEditor_PrefabricatorRuntime!APrefabActor::LoadPrefab() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabActor.cpp:109]
UnrealEditor_PrefabricatorRuntime!UPrefabComponent::PostEditChangeProperty() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabComponent.cpp:73]
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_PropertyEditor
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_ContentBrowser
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_Slate
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
UnrealEditor_ApplicationCore
user32
user32
UnrealEditor_ApplicationCore
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
Is there a workaround?
I'd like to use prefabs on construction as well
Best regards!
Undo after creating a prefab deletes it
Undo after dropping in a prefab crashes the editor
If External Actors is turned on (which it is by default) in the world settings, then a prefab might not load fully on map.
This doesn't always happen, but at some point it seems to get pretty consistent.
Hello, I've found an issue with adding volumes (eg NavMeshVolumes) to prefabs after updating from the plugin version 1.4 to 1.5.2
Setup:
First test used:
Unreal Engine 4.25.1
Prefabricator Release 1.4.0
Second test used:
Unreal Engine 4.25.1
Prefabricator Release 1.5.2
Steps:
I'll attach videos to discord with the tests I did above
Notes - I think it might be due to a change on how prefabs are saved, I noticed during the testing above that my prefab saved using the 1.4 plugin correctly "saved" the volume collision, as it loaded into the level when I pulled it out while testing the 1.5.2 plugin (before running the second test)
I'll see if i can do some digging on this now
After creating prefabs and prefab collections, after restarting editor every prefab collection is broken. When I drag new prefabs (nested prefab collections) into the editor window the prefabs are completely empty. Existing prefabs already in the level won't randomize anymore.
Try this:
In PrefabricatorAsset.cpp, line 99:
if (PrefabAssetPtr.IsNull()) {
PrefabAssetPtr = Prefabs.Last().PrefabAsset;
}
}
if (!PrefabAssetPtr.IsNull()) {
return PrefabAssetPtr.LoadSynchronous();
}
return nullptr;
On initial build, the FBox cannot be constructed with just a single FVector?
\BuiltPlugins\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp(720): error C2440: '': cannot convert from 'initializer list' to 'FBox'
\BuiltPlugins\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp(720): note: No constructor could take the source type, or constructor overload resolution was ambiguous
After removing the check above, I am also seeing build errors for UActorFactory::SpawnActor marked as final?
\Plugins\Prefabricator\Source\PrefabricatorEditor\Public\Asset\PrefabricatorActorFactory.h(14): error C3248: 'UActorFactory::SpawnActor': function declared as 'final' cannot be overridden by 'UPrefabricatorActorFactory::SpawnActor'
\Unreal\Engine\Source\Editor\UnrealEd\Classes\ActorFactories\ActorFactory.h(103): note: see declaration of 'UActorFactory::SpawnActor'
Detail customization button does not work on multiple selected actors bug only the first one
Nested prefabs with collections sometimes break the hierarchy in the world outliner
When modifying an existing prefab, adding a component and saving new changes to the prefab doesn't apply that component to the prefab asset.
Expectation: Prefabs created or modified with additional components added in level editor should save that added component along with any modifications to said component.
Custom collision channel boxes aren't saved within the prefab.
Even if you define a new channel preset.
This occurs regardless of if it's the original mesh(s) converted to a prefab, or dropping an already created prefab into the scene and using Browse to there.
Update: Bit of a misunderstanding, actually it doesn't browse to anything at all, but it does flash the Content Browser.
Beautiful plugin by the way, really appreciate you doing this.
Hello,
After you use the ctrl+z shortcut the engine crash, really often and annoying.
I hope you can fix this.
Thanks.
Prefab' modifications were lost after cut/copy and then paste.
example : change material , modify rotation of sub sub-actors, etc...
Mesh names can be very useful when trying to select groups of meshes within many prefabs in a level. All one needs to do is to write a substring of the mesh name and only the right ones are listed.
However, Prefabricator doesn't seem to always do it right. Prefabricator seems to correctly save the names of actors inside it when created or updated. However, it tends to break when creating randomised copies of the prefabs.
I have created a prefab containing some prefab collections (of the same type), each of them with 4 variations. Usually, the actor names appeared as they were saved. Then I created many other instances of that prefab, or reloaded old versions, and the actor names were not correct. The names were typically something like StaticMeshActor2141
when the number was automatically generated. Re-randomising the prefabs could randomly fix it or break existing correctly names actors. After several repetitions, it got so bad that the names were almost never correct.
Steps to repeat it reliably:
StaticMeshActor4214
This effectively prevents using the actor names for anything meaningful without manual correction afterwards.
I am using commit 5c08a0c with UE4.24.
I'v ported prefabricator to UE5 preview (just some member access are replaced by getters realy, no breaking changes), but
when using prefabs with WorldPartition all works in editor, but there is no way to build package as for every prefab those errors occur:
LoadErrors: Error: /Game/ExternalActors/Game/Maps/_WORKSPACES/WORKSPACE_WP1/02/84/9C5WXNTJTW5XVGSULS1D3 : Failed import for PrefabActor /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.ESV_AirInternational_01_15 Referenced by export StaticMeshComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.StaticMeshActor_UAID_4CCC6AF537C1CCA600_1379263771.StaticMeshComponent0
LoadErrors: Error: /Game/ExternalActors/Game/Maps/_WORKSPACES/WORKSPACE_WP1/02/84/9C5WXNTJTW5XVGSULS1D3 : Failed import for PrefabComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.ESV_AirInternational_01_15.PrefabComponent Referenced by export StaticMeshComponent /Game/Game/Maps/_WORKSPACES/WORKSPACE_WP1.WORKSPACE_WP1:PersistentLevel.StaticMeshActor_UAID_4CCC6AF537C1CCA600_1379263771.StaticMeshComponent0
any ideas what might it be ?
The hierarchy of attached actors is flattened after they are a part of a prefab. Explore ways of preserving this
Hi,
First of all thanks for this amazing plugin!
I can't find any C++ examples of how to Spawn a prefab. From the source code I see there is a method to do it, but I can't figure out how to include it to my project? I mean what #include
I need to use to get access to APrefabActor
type and SpawnPrefab
method?
UPROPERTY(EditDefaultsOnly)
APrefabActor* MyPrefab;
and then I need to call from my cpp
SpawnPrefab(const UObject* WorldContextObject, UPrefabricatorAssetInterface* MyPrefab, const FTransform& Transform, int32 Seed);
Prefab moves out of folder when randomized
Prefab size (bounding box?) is not considered when pressing F for focusing the object. Instead the editor camera zooms in to the prefab location.
Prefabs save the data as exported text. This doesn't make them show up in reference viewer and the editor cannot create redirectors due to it
Hi!
First of all Awesome tool we really like it a lot. =)
Unfortunatly we stumble upon a bug, but fortunatly we got a pretty straight forward repro.
->The PrefabActor is now pointing to a "None" prefab
Regards
Hervé
I consistently get an editor crash when I try to create a Prefab from two attached actors.
This is easily reproducable on my machine by attaching two actors to each other in the world, selecting one or both and creating a Prefab from the selection.
I am on the latest Prefabricator version (1.6.2) from the marketplace for UE4.26.1.
Assertion failed: ChildRoot [File:D:/Build/++Portal+Promotion/Sync/LocalBuilds/PluginTemp/HostProject/Plugins/Prefabricator/Source/PrefabricatorEditor/Private/Utils/PrefabricatorEditorService.cpp] [Line: 36]
UE4Editor_Core
UE4Editor_Core
UE4Editor_PrefabricatorEditor!FPrefabricatorEditorService::ParentActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Utils\PrefabricatorEditorService.cpp:36]
UE4Editor_PrefabricatorRuntime!FPrefabTools::ParentActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:54]
UE4Editor_PrefabricatorRuntime!FPrefabTools::LoadStateFromPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:844]
UE4Editor_PrefabricatorRuntime!APrefabActor::LoadPrefab() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabActor.cpp:109]
UE4Editor_PrefabricatorEditor!FPrefabricatorAssetThumbnailScene::SetPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Asset\Thumbnail\PrefabricatorAssetThumbnailScene.cpp:41]
UE4Editor_PrefabricatorEditor!FPrefabEditorTools::CapturePrefabAssetThumbnail() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorEditor\Private\Utils\PrefabEditorTools.cpp:109]
UE4Editor_PrefabricatorRuntime!FPrefabTools::SaveStateToPrefabAsset() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:298]
UE4Editor_PrefabricatorRuntime!FPrefabTools::CreatePrefabFromActors() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:190]
UE4Editor_PrefabricatorRuntime!FPrefabTools::CreatePrefab() [D:\Build\++Portal+Promotion\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\Prefabricator\Source\PrefabricatorRuntime\Private\Prefab\PrefabTools.cpp:115]
UE4Editor_PrefabricatorEditor!TBaseStaticDelegateInstance<void __cdecl(void),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\RocketSync\4.26.0-14830424+++UE4+Release-4.26\Working\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:731]
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
.
.
.
Expose prefab editor functionality to editor blueprints. This is helpful for automation
Steps to reproduce:
-> prefab is located at 0,0,0
Also, if a prefab contains lights, those don't affect the prefabs pivot point.
In UE 5.3, any time you create a prefab that contains a landscape it crashes the whole engine.
If you have a collection, that contains a couple of prefabs, and this collection has been placed into a level, then the "Randomize" button on the instantiated collection will sometimes not randomize between all its prefabs. Rather, it seems that it will only randomize between the prefabs that are currently loaded.
Repro steps:
I haven't looked deeply into the code, but I suspect that the randomization mechanism will skip prefabs that are not currently loaded. The appropriate behavior is to force loading of the asset that is chosen by the randomization. (Or: first force loading of all assets referenced by the collection, then randomize between the assets that are loaded.)
When saving a prefab, localized changes to nested child prefabs are not saved
Nav mesh modifiers do not take effect when they are part of a prefab. The volume becomes invisible
Create Prefab Collection context menu from the content browser is not working
The content of the prefabricated part is empty.
IWYU (Include What You Use)
Currently working through include uses by turning off PCH usage in Unreal.
A nontrivial amount of issues are being encountered by Prefabricator headers not including dependencies.
I don't mind fixing these but I'm concerned about future integration issues.
I am having issue with the cross actor reference support. Specifically child actors are treated as cross reference actors which isn't the case right? At the very least isn't CrossReference a bad choice of name for this concept if it refers to a prefab's own child actors?
void FPrefabTools::SaveStateToPrefabAsset(APrefabActor* PrefabActor)
{
if (!PrefabActor) {
UE_LOG(LogPrefabTools, Error, TEXT("Invalid prefab actor reference"));
return;
}
UPrefabricatorAsset* PrefabAsset = PrefabAsset = Cast<UPrefabricatorAsset>(PrefabActor->PrefabComponent->PrefabAssetInterface.LoadSynchronous());
if (!PrefabAsset) {
//UE_LOG(LogPrefabTools, Error, TEXT("Prefab asset is not assigned correctly"));
return;
}
PrefabAsset->PrefabMobility = PrefabActor->GetRootComponent()->Mobility;
PrefabAsset->ActorData.Reset();
TArray<AActor*> Children;
GetActorChildren(PrefabActor, Children);
// Make sure the children do not have duplicate asset user data template ids
{
TSet<FGuid> VisitedItemId;
for (AActor* ChildActor : Children) {
if (ChildActor && ChildActor->GetRootComponent()) {
UPrefabricatorAssetUserData* ChildUserData = ChildActor->GetRootComponent()->GetAssetUserData<UPrefabricatorAssetUserData>();
if (ChildUserData) {
if (VisitedItemId.Contains(ChildUserData->ItemID)) {
ChildUserData->ItemID = FGuid::NewGuid();
ChildUserData->Modify();
}
VisitedItemId.Add(ChildUserData->ItemID);
}
}
}
}
struct FSaveContext {
AActor* ChildActor;
int32 ItemIndex;
};
FPrefabActorLookup ActorCrossReferences;
TArray<FSaveContext> ItemsToSave;
for (AActor* ChildActor : Children) {
if (ChildActor && ChildActor->GetRootComponent()) {
UPrefabricatorAssetUserData* ChildUserData = ChildActor->GetRootComponent()->GetAssetUserData<UPrefabricatorAssetUserData>();
FGuid ItemID;
if (ChildUserData && ChildUserData->PrefabActor == PrefabActor) {
ItemID = ChildUserData->ItemID;
}
else {
ItemID = FGuid::NewGuid();
}
AssignAssetUserData(ChildActor, ItemID, PrefabActor);
int32 NewItemIndex = PrefabAsset->ActorData.AddDefaulted();
FPrefabricatorActorData& ActorData = PrefabAsset->ActorData[NewItemIndex];
ActorData.PrefabItemID = ItemID;
ActorCrossReferences.Register(ChildActor, ItemID);
FSaveContext SaveInfo;
SaveInfo.ChildActor = ChildActor;
SaveInfo.ItemIndex = NewItemIndex;
ItemsToSave.Add(SaveInfo);
}
}
for (const FSaveContext& SaveInfo : ItemsToSave) {
AActor* ChildActor = SaveInfo.ChildActor;
if (ChildActor && ChildActor->GetRootComponent()) {
FPrefabricatorActorData& ActorData = PrefabAsset->ActorData[SaveInfo.ItemIndex];
SaveActorState(ChildActor, PrefabActor, ActorCrossReferences, ActorData);
}
}
PrefabAsset->Version = (uint32)EPrefabricatorAssetVersion::LatestVersion;
PrefabActor->PrefabComponent->UpdateBounds();
// Regenerate a new update id for the prefab asset
PrefabAsset->LastUpdateID = FGuid::NewGuid();
PrefabActor->LastUpdateID = PrefabAsset->LastUpdateID;
PrefabAsset->Modify();
TSharedPtr<IPrefabricatorService> Service = FPrefabricatorService::Get();
if (Service.IsValid()) {
Service->CaptureThumb(PrefabAsset);
}
}
I noticed someone had the same issue in the past.
https://discord.com/channels/233207002463993857/530052996734779397/713112405722398730
it is a transient property , but serialized by UStaticMeshComponent::Serialize
but at this time, PrefabActor->GetPrefabAsset() == nullptr, so ActorState is not loaded
Hi there,
we developed something in the editor using the plugin and it worked fine. The prefabs are spawned at runtime. Unfortunatelly they are not spawned (or are not visible) when packaging for windows 64 bit platform.
Do we have to do something or is this a bug?
I created a lot of prefabs with 4.25. If i place one of these prefabs in a level and build anything 4.26 crashes during map check. I could repair most prefabs by placing them and hit "Save Prefab to Asset" to resave them. Reference to level is gone then. Though a few prefabs keep the reference.
Hi there,
when I'm using the prefab component within a BP the Prefabasset is not shown.
I have attachted the prefab component to a scene component.
The "P" Sprite and the green boundaries are shown correctly, only the prefab asset itself is not displayed.
Any hints what could be the problem here?
I'm using UE 5.0.3-20979098
Hello. Recent release announcement says about 5.1 - 5.3, but what about 4.27 (or lower)? Thank You/ (UE5 is not main thing for many yet)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.