Download

Prefab Tool - Prefab Support for Unreal Engine

Prefab Tool is available onitch.io and Unreal Marketplace

Hi, I’ve been working on a Prefab solution for Unreal Engine: Prefab Tool.

Prefab Tool is inspired by the article: BUILDING THE OPEN WORLD FOR DEAD ISLAND 2 WITH UNREAL ENGINE 4, also the Prefab in UDK.

Feature List:

  • Create Prefab from collection of actors in the level
  • Nested Prefab to support complex scene hierarchy
  • Preview Prefab Thumbnail in Content Browser and Detail View
  • Drag and drop Prefab into the level to instantiate actors collection
  • Edit Prefab directly inside level editor
  • Apply changes of Prefab to all Prefab instances
  • Revert changes of Prefab instances
  • Convert Prefab instances to normal actors
  • Destroy Prefab Actor with option to destroy whole hierarchy
  • Swap Prefab Asset anytime

Hi Nate!

This looks really good! Can you clarify, what is the difference between creating a prefab from actors in the scene vs creating an actor blueprint with those elements and then dragging that BP to the level?

Thanks for the awesome work!

I am really looking forward to this :slight_smile:

Really looking forward to this. Having bought two of your previous plugins I have no doubt this is going to be fantastic. Been missing prefabs from UDK for years.

Yes… this please. Is it less resource heavy somehow?
Like can I build a makeshift gun out of 3 cubes and then join them as a prefab and then use that as a static mesh placeholder for example?

Good question, let me first post a quote from the dead island article, which by the way convinced me that it’s worthy to bring back prefab support to UE4:

While Blueprint and Prefab can both be used to host child actors, there’re couple differences:

  • Prefab is created from the level editor and edited in place in the same level editor
  • Prefab instances are just normal actors in the level, there’s no class generated, no compilation needed
  • Prefab can host any type of actors supporting scene hierarchy (can be attached to other actor), and can be nested to form complex structure
  • Prefab is an editor-only tool, you can spawn blueprint instance in runtime, but can only spawn prefab instances in editor

Basically the idea of Prefab is to be used as a level constructing helper. If you’re already comfortable with using Blueprint to host child actors in your workflow, then probablly there’s no need for a Prefab solution.

No special resources needed, both Prefab Actors and it’s Children Actors are just normal actors.
When dragging a Prefab into level, a Prefab Actor will be created, then all actors saved in the prefab will be created as children of the Prefab Actor. The Prefab Actor is essentially an empty actor (with editor-only logic to manage children actors), and can be convert to normal actor later if you choose to. And you can also choose to delete the Prefab Actor after placement if you don’t need the actor hierarchy.

You can make a prefab from the 3 cube actors, and then update the cube actors with final static mesh later.

Prefab with Blueprints:

https://youtube.com/watch?v=kNnsz78CfrE

Prefab as Actor Placeholders

https://youtube.com/watch?v=dBj0AkoSLvI

How much will this cost and when can we expect it to hit the marketplace?

Does your prefab system allow for editor-only actors?
I mean. Can I add actors to the prefab, that I can set to be compiled out of the final build (in case I am using actors who are useful only inside the editor)?

The price will be $24.99. I plan to submit to marketplace next week, then it’s up to how long the review process might take.

As far as I know, there’s no way to tag an actor as “editor only” inside editor. You can mark a component as “editor only” to exclude the specific componet from cooking, but I assuem that’s not what you want.
Actually in my previous prefab implementation (Prefab Tool is my second attempt of Prefab implementation), there’s a concept call “Transient” Prefab. Once you mark a Prefab Actor in the level “Transient”, all childeren actors under this Prefab Actor will never be savee into map but be generated every time when map opened, which make them never be cooked hence “editor only”. But there was may limitations of that particular feature might confuse people and I haven’t found useful usecase myself so I ruled out that feature in current version.
May I ask what kind of situation you need for editor-only actors?

I need it for editor-only content. Actors that procedurally generate stuff depending on their context / location and variable values. The generated content is what I would like to keep in-game. But I wouldnt need the “generators”, so I dont want to include them into the final build.

Nice work @Nate. This is a much needed feature in the engine. Looking forward to the release.

It looks like this will work only from within the editor? Can we have a reference to a prefab asset class and then later spawn an actor using that class using the spawn actor blueprint node? If not, would it be possible to also support runtime spawning as it will be useful while building procedural levels at runtime

https://docs.unrealengine.com/latest/images/Gameplay/HowTo/SpawnAndDestroyActors/Blueprints/GHT1_4.jpg

You might want to have a look at AGroupActor. It resides in the engine’s editor module and is not available in the map’s actor list in standalone builds

[MENTION=28980]Ali Akbar[/MENTION], thanks! Yes, it works only within the editor, via ActorFactory to be precisely. Spawning a prefab actor by using SpawnActor blueprint node and then assign a prefab asset to trigger instances spawning is not implemented but should be easy to do, just that it also only works in the editor so might not be that useful.

Added SetPrefab UFunction to Prefab Actor, it’s possible now to spawn Prefab via Blueprint (editor only).

The video shows using that with Blutility.

https://youtube.com/watch?v=MOgbZDexuWE

Is it possible to save the spawned prefabs in the level after spawning them with Blutility? I’ve had problems trying to save any component spawned with blutility and hope that using your prefabs somehow could be a workaround.

@Sitrec, yes, you can save all spawned prefab instances in the level since there’re just normal actors after spawned by the blutility.

Great! Would it be possible to add content to a prefab with blueprints?
I have a blutility that spawns hierarchical instanced static mesh components but have had trouble finding a decent way of saving them since they get reset by moving the blutility and doesn’t save with the level.
I don’t want to use construction script as I want to make sure it doesn’t run any code when starting the game.

It does work to select my blurility with it’s spawned components and convert them with your instance tool, but I run into problems when I want to add more instances later, having to convert everything back to meshes before instancing again is going to be tedious. I tried selecting the actor to add them to but it all HISMAs are located in different actors and doing it one by one would be too much work for what I’m trying to do.

Thanks! :slight_smile:

@Sitrec, I think Prefab might not be the “right” solution/workaround for the blutility issue you encountered.

I posted my test blutility setup regrading spawning HISMC instances via blutility on your another post (
https://forums.unrealengine.com/showthread.php?145038-Blutility-Call-in-editor-is-there-any-way-to-actually-save-spawned-components&p=709745#post709745 ), hope that helps.