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?
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.
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
[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.
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.
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.