Prefabricator - Open Source Prefab Plugin

Hey [USER=“28980”]Ali Akbar[/USER] I tried to make with the prefab and also with dungeon architect some boxes with physics enabled it seems it is not working :(. I wanted to setup some boxes one over another theny to make them fall. Andto make them have physics enabled but it didn’t work. Maybe you can figure out. Thank you.

@anonymous_user_be681c47 Sorry for the issue. I’ll have a look

[USER=“13759”]Ion Cocarcea[/USER] I’ve tested with physics enabled a while ago and it worked. I’ll test it again tomorrow

Random thought. Is it possible to use prefabs with landscapes or height maps? Say if I wanted to use this to make random-ish mountains that are in the same location but different design of mountains. Awesome looking Plugin and even if landscapes/heightmaps are out of the question I’ll still be picking this up.

Spawning Prefabs from a Blueprint Construction Script is not supported right now. Will it be possible in a future version?

@Methosborgoff Thank you! Landscapes are not supported and saving the heavy heightmap data will be out of the scope as this deals with properties

@Ben_Cykyria Try calling Load Prefab function from the prefab actor. I also made a change this morning that shouldn’t require this call. I’ll test it tomorrow and let you know

[USER=“28980”]Ali Akbar[/USER] this is my simple blueprint test in the screenshot. The debug shows that the construction script is run without error. I tried a different stuff for the world context object. Anyway, what I want to do, is I’d like to place prefabs in editor, and adjust them. Blueprint “Building” will spawn one or many “Floor” prefabs. I can’t do that with prefab collections. It works in play mode, but then I can’t see how the building will fit into the landscape (this would be much easier in the editor).

Thank you for creating this!

I have a few questions:

  1. Instantiating
    How performant is Prefabricator as compared to HISM? It looks blazingly fast in your demos but would I be better off using HISM for large amounts of objects (like asteroids)? Does Prefabricator replace (or utilize) the built-in hierarchical instantiation? btw: I was trying to build a corridor that has the same walls on both sides and Prefabricator doesn’t seem to allow me to use HISM within P_objects.

  2. Prefab Collections
    When I double click my newly created “Prefab Collection” I get a blank tab that takes over my screen that’s titled, “PC_Ceilings* - Generic Assets”. I’m on an iMac running the latest software. I tried re-booting and deleting my various project folders.
    EDIT I found how to do it for anyone else curious: Select the Prefabricated objects in your Content folder and right click and choose “Create Prefab Collection”
    **Note: **Double clicking on the PC_collection icon still only opens a blank screen so I cannot see what’s in the collection or affect the weighting.

  3. Interactivity
    I know that Prefab is Blueprintable but can I put damage decals and otherwise affect Prefab actors in the world?
    Note: It appears that Prefabricated objects cannot be set to “Movable”

Hey writing to say that thanks for this plugin, it’s a great work you’ve done here.

Just little issue and that’s simply to do with using the plugin in c++. Right now the blueprint function library cannot be used in c++ (to spawn Prefabs in code) due to the symbols not being exported as it’s missing the XXX_API definition (linker errors). It’s only a small issue as the source is available in GitHub and you can make those modifications there if you need the code implementation or you can simply copy the implementation inside the function you need to use (it’s source so you can do whatever).

Other than that this plugin has been a great help, many thanks.

1: HISM is not supported and I’ll be adding that in the future. If you want instancing, please stick with HISM for now
2: Thank you for the steps, it helps with debugging. However, I cannot reproduce it on my end. I’ll keep testing it
3: I’ve fixed this and will be available in the next build soon

Thank you @TexelBud

I’ve added exports on the following missing classes

Runtime Module


    UPrefabricatorBlueprintLibrary

Editor Module


    FPrefabricatorAssetBroker
    FEditorUIExtender
    FPrefabActorCustomization
    FPrefabRandomizerCustomization
    FPrefabricatorSelectionHook
    FPrefabEditorStyle
    IPrefabricatorEditorModule

@Ben_Cykyria The engine doesn’t allow spawning actors in the construction script. A better way would be to allow you to add PrefabComponent to your blueprint’s component list, which is not supported yet. I’ll explore ways and try to add this in the next build

Firstly, thanks again for this brilliant plugin - I got it before it was on the marketplace and I’m really happy it’s on here now. It is exactly the kind of tool I needed.

I’m currently using it to place a variety of drippy candles around a few rooms, but I’ve hit a problem with lights.

  1. When lights are part of the Prefab, the lighting doesn’t update in the same way that they would if I’d placed the light in a scene manually.

Repro: place a static mesh and a point light. > create a prefab > duplicate it - the light is not ‘on’. If you edit light in the new Prefab (e.g. change the luminosity) the light will begin to show in the preview lighting render.

  1. Lights have duplicate GUIDs.

Repro: place a static mesh and a point light. > create a prefab > duplicate it > build lighting and enjoy the ‘PointLight_Blueprint’ has the same GUID as ‘Light-Flickering_C_01’ warnings.

Like I say, I love what you’re doing here. Keep up the great work!

Thank you @CopperStoneSea, I’m happy you find it useful

I just check the lighting/build issue and cannot reproduce it on my end. (I do get the temporary large X mark on the light which I’ll look into, but the lights work as expected)

Does this also happen on a new empty scene?

It’s not an empty scene, but it’s certainly odd behaviour, and another one has started too! I’ve attached a couple of images to show what’s going on.

(bigger version attached to this reply)

In this image, you can see that I’ve got a nice prefab composed of five candle-prefab-collections and a few lights. The prefab is in the scene on the left. I’ll refer to this as the ‘top prefab’.

You can see the five smaller collections in the content browser. Each of those collections contains three prefabs that are assembled candles and wax blobs with a particle effect on top.

When I first assembled these, I could duplicate the top prefab either directly in the scene or by dragging Prefab15 from my library, but the lights wouldn’t work. If I go into the duplicated prefab and change anything then the lights begin to work.

In the image, you can see a duplicate of Prefab15 where the lights are not working at all… And a new bug has appeared!

Between last writing on here and today, I closed UE4. When I reopened it, I discovered that the top prefab from previous sessions looks fine, but when I duplicate it then the meshes don’t appear! The green-outline bounding box of the prefab also only covers the lights, not the meshes (i.e. where the meshes should be appearing).

Which is odd… But wait, there’s more!


In this image, I’ve duplicated it, but the meshes do show up… So what changed?

Between the first image and the second image, I dragged all of the lower prefabs (‘prefab’, ‘prefab1’, ‘prefab2’, etc.) into the scene and then deleted them. After doing this, they began to appear when I placed collections containing those prefabs.

I also discovered something else. I dragged only one of the wide-candle prefabs into my scene, then placed the wide-candle collection in the scene. When I clicked ‘randomize’ on the collection, only the candle that I’d dragged in would appear in the collection - the collection would appear empty two-out-of-three randomizations!

By placing all the prefabs into the scene once and then deleting them, I could duplicate the top prefab and the meshes would now appear (as you can see on the right in the image above). Additionally, after doing this, if I press ‘randomize’ on the middle version of the top prefab, the meshes now appear correctly.

It’s all very intriguing, and I’ve no idea what’s going on, but it appears that prefabs appear to need to be in the scene individually before collections will work with them properly… Or they need to be placed per-UE4-editor session for collections to work.

I hope this helps you track down some of what may be going on!

(BTW, the red X mark on your lights means that you have too many overlapping moving lights - if you reduce the radius of effect then that will often fix the problem, or turn the lights to ‘static’).

As you can see - I think prefabs are going to be a really powerful way for me to create some great randomised placements of objects in my game, but I’ve hit some really interesting bugs!

Thinking more about this, the common thread seems to be that meshes/lights in the stack of prefabs and collections don’t show up properly until they have been adjusted or placed in the scene.

I’ve also tried a few different sequences of actions:

Duplicate top prefab >
nothing shows up on top prefab (no lights, no meshes)

Duplicate top prefab >
nothing shows up on top prefab (no lights, no meshes) >
save, close, reopen >
no change

Duplicate top prefab >
nothing shows up on top prefab (no lights, no meshes) >
place all the lowest prefabs (only meshes and particles) in the scene >
nothing shows up on top prefab (no lights, no meshes)

Duplicate top prefab >
nothing shows up on top prefab(no lights, no meshes) >
place all the lowest prefabs (only meshes and particles) in the scene >
nothing shows up on top prefab (no lights, no meshes) >
randomize the duplicated prefab >
meshes appear - lights don’t work

Duplicate top prefab >
nothing shows up on top mesh (no lights, no meshes) >
place all the lowest prefabs (only meshes and particles) in the scene >
nothing shows up on top mesh (no lights, no meshes) >
save game >
meshes appear on the duplicated prefab - lights still not working

Duplicate top prefab >
nothing shows up on top prefab (no lights, no meshes) >
place all the lowest prefabs (only meshes and particles) in the scene >
nothing shows up on top prefab (no lights, no meshes) >
save game >
meshes appear on the duplicated prefab - lights still not working >
go in to every light and adjust it (move then Ctrl+z undo is enough!) >
now both the meshes and lights are working!

Duplicate top prefab >
nothing shows upon top prefab (no lights, no meshes) >
place all the lowest prefabs (only meshes and particles) in the scene >
nothing shows up on top prefab (no lights, no meshes) >
save game >
meshes appear on the duplicated prefab - lights still not working >
go in to every light and adjust it (move then Ctrl+z undo is enough!) >
now both the meshes and lights are working! >
duplicate the duplicated top prefab >
meshes work, lights don’t >
save, close, reopen >
duplicate the duplicated top prefab >
nothing shows up on top prefab (no lights, no meshes)

So… That’s a few versions!

I just had a small brainwave regarding the lights! My lights are actually part of a blueprint (I use a mix of static and stationary versions to get the effect I want - the stationary one flickers a bit).

When I create a prefab with a normal point-light and my blueprint ‘flickering light’, duplicating the blueprint stops the blueprint-light working while the normal-point-light continues to work.

So, there’s an issue with lights components in blueprints that are part of prefabs - they can work, but seemingly only once they have been adjusted after the prefab has been placed. This adjustment only needs to happen once for it to be permanently okay, but duplicates need it to be done again.

Hopefully this isn’t out of place but I am struggling. I am using Prefabricator to make a prefab that consists of BPs and static meshes. I then spawn a line of them on begin play. My problem is that I can not(read-can’t figure out how) to destroy a prefab. What I would like to do is specify an index to destroy anything attached to the prefab at that specific index. I am able to destroy some actors using a complicated scaling/overlapping/mess of a bp but it does not accurately destroy everything. Any guidance would be greatly appreciated.

I’m looking for this flow of functionality;
spawn prefabs -> store list of spawned prefabs-> set desired prefab to destroy from external bp -> destroy desired prefab -> update list of stored prefabs.

Below is the solution I came up with. I removed the spawning from the level blueprint and put the creating and destruction logic all in the same bp.

I found another use:
Water

There isn’t a super quick way in the engine to throw down all the pieces -plane for water, physics volume, etc.

So you just toss it all down and make a prefab. Of course you still have to adjust it and everything but, its all the pieces. Which is huge time saver