UDN
Search public documentation:
UsingPrefabs
日本語訳
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
Using Prefabs
Overview
Suggested Workflow
- Use Prefabs as a level placement device only.
- This means that once a prefab is placed in a level, it should be immediately converted back to straightforward actors by right-clicking and choosing Convert PrefabInstance To Normal Actors.
- Avoid certain advanced features, including propagating actor property changes to prefab instances already placed in the level, and storing Kismet logic within the prefab asset.
Creating a Prefab
Then select them all, right-click and choose Create Prefab from the context menu.
You will be prompted for a Package Name, optional Group Name and a name for the new Prefab.
It will then ask you if you want to replace the selected Actors with an instance of the new Prefab. The origin that is selected for the new Prefab is the origin of the largest Actor that was selected.
You should now be able to see the new Prefab in the Content Browser. Prefabs display a thumbnail showing the the Prefab in the level when you created it. This is taken from the position of the camera in the perspective editor view port when the Prefab was created, so its worth getting a good view on your objects before you create the Prefab.
Placing a Prefab Instance
This is used for keeping track of the Prefab that was used for this instance, and which Actors are part of it.
When you create a Prefab, references between Actors within the Prefab are correctly preserved. So if you have an Actor attached to another Actor in the Prefab, this will be handled correctly each time you place the Prefab. However, any references to Actors outside the Prefab will be cleared.
Editing a Prefab
However, you sometimes want to edit a particular Actor within a Prefab. To do this, you will need to first unlock prefabs from selection. This is done by opening the View menu and unchecking the "Lock Prefabs from Selection". From there you can select the individual actors that belong to that Prefab.
Updating a Prefab
Reseting a Prefab
Add a Kismet Sequence to a Prefab
If you answer Yes, it performs an extra check that there are no references within this Sequence to Actors that are not in the Prefab. If this is the case, it will display a warning and will not include the Sequence in the Prefab.
When you place a Prefab that contains a Kismet sequence into a level, it will instance the Kismet sequence into a top-level sub-sequence called Prefabs. Each instance of a Prefab in a level has its own copy of the associated Kismet sequence. When the Prefab is updated, the Kismet sequence for each instance is completely replaced from the one in the Prefab, so it not possible to customize the Kismet sequence per-instance. However, it is possible to add input, outputs and variable connectors to the Kismet sequences of the Prefab. In this way you can expose functionality to Level Designers. An example of this might be a door prefab whose sequences exposes inputs for locking and opening the door, and an output which is fired each time the door is opened.
Converting a Prefab back to Normal Actors.
Prefab Tips
- If you select an Actor that is part of a Prefab instance, you can press Shift-P to select all Actors which are part of that instance. You can also do this by choosing the Select All Actors In Prefab(s) option from the context menu.
- If you select a PrefabInstance, you can choose Open Sequence For PrefabInstance In Kismet, to open Kismet and jump straight to the sub-sequence for that instance.
