Prefab Tool - Prefab Support for Unreal Engine

Do Prefabs work with custom C++ components built off an Unreal engine built from source?
I have actors with custom components (C++ blueprints) built using a custom Unreal engine 4.17. The components access parts of NVidia PhysX that are not available through the general build. If I build prefabs from standard actors and these custom components, do you foresee any problems? I want to use the prefabs in a way similar to the way we’ve used them in Unity.

regarding - 1.0.6 Update
Holy cow!!! :eek: Everyone on our team is totally blown away by the extraordinary attention from you to our requests and bugs. We greatly appreciate your work!

@jkraptor Sorry that I somehow missed your post. For prefab with custom c++ components it should works just fine as long as properties of your c++ components could be serialized (with UE4’s default serializer). E.g. if you can copy and paste the actor with the custom c++ component, you should be able to save the actor inside the prefab as well.

@Denis.Korkh, so glad to hear that :slight_smile: Hope seeing your works!

We modified the uplugin file to remove the WhitelistPlatforms for the runtime module. I’m not sure if you had a reason for doing that or not, but with that setup it does not work on a console build.

Oh, the only reason that WhitelistPlatforms line was added to the uplugin file is that it’s a requirement when submitting code plugin to Unreal Marketplace. I think Epic is using that info to build necessary binaries when staging the plugin for marketplace download.

Hi, I’m setting up discord server for all my tools:

Please feel free to post discussion / feature request / bug report in either place.

( I’m travelling from 14.Nov 2017 to 1 Dec.2017, and will be more active on discord when I’m back.)

Hello!

First of all, thank you for creating this tool and for me it’s been of great help so far.

Well, I say so far because I’ve just discovered a potential issue. I need to deliver my project to the client soon and I’ve just figured out that when I package the game as an executable, all prefabs stored in content and loaded from there by my blueprints (I spawn prefabs in runtime) don’t show up in the executable. The issue is that the prefab has 0 children in it and hence can’t spawn them. Am I doing something wrong here?

This blueprint is placed in the scene and has array reference to prefabs which are then spawned using spawn actor and assigning a prefab to it. It works in editor no problems, but not in executable. Also, when packaging the project, I packaged the map with directory which stores prefabs.

Is there an obvious solution that I’m missing here?

/begin sandwich/

Still love your tool!

Noticed another issue;

  1. Drag a static mesh asset into scene (turns into static mesh actor)
  2. Right-click in content browser, create prefab (from the new static mesh actor which is selected)
  3. Save prefab, place in level.
  4. Rename the static mesh asset.
  5. Place prefab in level again - it’s static mesh actor child will not have a static mesh assigned.
  6. Reverting the previously placed prefab also unsets the mesh from its static mesh actor.

Your tool is the best.

/end sandwich/

But really, great work! Our team uses it a ton and loves it.

@Denis.Korkh I can’t reproduce the issue your encountered in 4.18. May I ask what engine version are you using? (and have you update Prefab Tool to latest version?)

Hey ,
I am having an issue with the plugin not allowing me to create new prefabs. I can select the Prefab filter, to allow me to navigate only prefab actors in my content browser, however, when I right click in the browser, there is no Prefab tab. I notice it should appear under “Physics” and above “Sounds”, but it does not show up in either the “Create New” button, nor under the right click drop down. I am hoping you know the quick fix. I have of course, activated the plugin in the plugins tab.

Thanks for your time

Plugin Version: 1.0.7
Engine Version: 4.18.2

Hi @Rallii Have you select any actors in the level before right click on the content browser?
A prefab could only be created with at least one actor been selected.

Strange. I’m using UE 4.18.2 and Prefab 1.0.7
I double checked my repro steps and still get the same result. (regarding renaming the source static mesh.)

Edit:
The only thing I can think of is that if one were to do this to a static mesh which is referenced by other assets such that it creates a redirector - I imagine the repro steps wouldn’t produce the same bug since the prefab would point to the newly created redirector. In my case, no redirector for the source mesh is created since no other assets reference it. Hope this helps.

Edit2:
I walked through it a little and have found that the PrefabContent string contains the old source mesh name after the rename.
The prefab which is already placed in level during rename is handled properly but changes to it aren’t propagated to the asset - if I hit apply on the already placed prefab after source mesh rename placing prefab of that type works after. In summary, renaming source mesh fixes references in prefab instances already placed in level but not the asset version of it in the content browser.

Edit3:
I think I found the problem and it has to do with not saving the level during any of the steps. If I save the level even just after placing the original static mesh, before creating the prefab everything works ok. I stumbled on it by looking at where it was getting the content string and it appeared to be looking through the level for the static mesh actor archetype definition which still had the old mesh name. So I suppose I stumbled into an edge case - I don’t imagine this would come up often.

@Denis.Korkh Thanks a lot for your detail repro steps! I just found out that in 4.18 there’re extra quote string for asset’s path which causing asset references tracking failed. I’m working on a fix for that.

No problem, thank you for being on top of it! I have an unrelated thought as part of making a prefab best practices for our project and figured I’d share.

In addition to using prefabs for organizing arrangements of props, our artists were asking for this sort of tech in order to be able preserve the ability to make project-wide changes to a single arrangement of props. Example: given a prefab of a tree stump w/ rocks and flowers around it we may want to tilt the stump at an angle to give it attitude.

Prefab allows exactly that but the problem on a bigger project is you never have full knowledge of the context of any given instance of this stump. Suppose somewhere in the project an apple was placed on the tree stump which would now probably either intersect or float above the tilted tree stump. So its a very tempting practice but I think its dangerous on a large project and may discourage it. An interesting feature which may help this problem would be a way to render out a snapshot of each place some prefab is used. It may be challenging to have a general solution where to place the view for rendering the instances. One way might be to allow a prefab to have a thumbnail scene node/camera which can be adjusted by the artist for this purpose. For my example (tree stump and flowers) I might arrange the camera overhead. I’m tempted to hack something like this together but it may also be an interesting feature out of the box.

Hello there :slight_smile:

I’m encountering issues regarding the “Generate Blueprint” feature!

When I create a Prefab composed of StaticMeshActors and “Generate Blueprint” out of it, it generates a Blueprint with Child Actors filled with StaticMeshActors instead of creating a Blueprint with Static Mesh components.

Another issue I have is the “Generated Blueprint” reference is lost when I remove the Prefab which originally generated it off the map. Replacing the Prefab gives me an unconnected Prefab and I have to manually reconnect the Prefab and its Blueprint.

And something I would love to see added is to be able to specify an array of actor class that I would like the “Generate Blueprint” feature not to add to the generated Blueprint. I’d like to specify this in a global way.

I was doing a series of tutorial about building a Diablo-like dungeon generator and I really counted on that feature to streamline the level design process. I made a video about using Prefab Tool and in the middle of it I realized these two bugs were kind of ruining the perfect workflow Prefab Tool can offer :frowning:

I love the work you’re doing, hope you’ll get everything solved!

Good luck and have fun everyone :slight_smile:

@Yun-Kun

“Generate Blueprint” currently will always create child actors for every actors inside the prefab. In next update, I’ll add an option to try harvest components instead of creating child actors. (Thanks to the code contribution from you and your team!)

Generate blueprint reference currently is stored inside prefab component but not in prefab asset. The original thought is that one prefab could be used to generate multiple version of blueprint. But that seems over-design and causing confusion. I’ll also change that in next update.

The “Ignore Actor Classes” is a great idea. Will working on that.

@Denis.Korkh

Sorry that somehow I totally missed your reply. For the scenario you described, I think maybe adding a new prefab usage window, containing a list of prefab actors, so artist can navigate through the list, and the level editor viewport will zoom to selected prefab actor automatically to make it easier to spot any placement issue.

Omg! I’m sorry I made it look like a bug :stuck_out_tongue: I got baited by our internal version of Prefab Tool!

The best thing would be that everything that is not an Actor Blueprint should be added as a component to the generated Blueprint (to includes things such as Sounds, Particle System etc…).

Okay, that make sense! If you implement the change we’re talking about we’ll have both options (by regenerating a new Blueprint if we want to create a new one from a Prefab we already created a Blueprint for).

Lighting speed answer as usual, thank you very much. I’ll probably add an update video to my tutorial series once it is done.

Good luck and have fun everyone :slight_smile:

whats the easiest way to delete everything in the prefab from the level with everything in it ? If you hit delete(keyboard) not in your prefab window it dumps everything out of the prefab into the world outliner - this is very frustrating = then you gotta select everything again and delete those - why ?? That action is totally counter -intuitive to what would be expected

With one or more prefabs selected in the World Outliner, look at the Details pane, find the “Prefab” section, and click the “Destroy Hierarchy” button.

I’m curious about the performance of Prefab Tool. My project has large maps with clusters of buildings that have been put into prefabs, and then a few (ten or less) copies of these clusters are scattered around the map. These building clusters in some cases are very large, with hundreds of static mesh actors inside. Making a change to one of these prefab instances in the world via Unlock and ApplyAndLock ends up taking in some cases hundreds of seconds (a few minutes). Is anyone else seeing this slowdown? Is it something I’m doing wrong? Is there any work being done on the plugin to bring this time down?