Monday, October 8, 2012

Cookbook: Prefabs

Ever wondering how to compose some complex set of meshes with animations, sound effects, particles into one object with ability of easy instancing? Well, in this case Prefabs are just what you are looking for!

You can create them easily in UnrealEd and reuse wherever you need them without the need to painfully copy kismet schemes, setting all the different parameters, etc. And of course you can decompose your prefab, change a few things and create another version for later reuse.

Let's say we want to have doors that are opened by a button/lever (that requires at least button actor, door interpactor, matinee for doors and kismet assemble). Quite a lot to handle repeatedly if you can just instance one composed prefab instead ;). Here is an example how to create given prefab in editor:


  • insert individual meshes/archetypes for both button and door



  • prepare kismet setup and simple matinee with movement track for door InterpActor



  • with all individual parts set and selected, right click and choose Create Prefab... option. Choose package name, etc. and select Yes for prompt to found kismet sequence (to make it part of prefab) and replacing individual actors in scene with prefab. From now on you can insert another instances of this prefab setup from your Content Browser (and of course position/rotate them differently to work appropriately in your level).



  • in case you need to change some parts of prefab, select its instance and right click, Convert PrefabInstance To Normal Actors, update, create different version of prefab, etc.




No comments:

Post a Comment