Prefabs
Prefabs are templates for the objects you add to the scene. For example, you can add to the scene multiple instances of n_and_s_700s_tower_crane_prefab, place them in different locations and give different tags and other properties.
Types of prefabs:
Type |
Description |
---|---|
Can be broken and have animations for fixing, can have special zones (shop, sand quarry, recycling zone, and so on), can be interactive. |
|
The player can ride in those vehicles and generally interact with them. |
|
Decorative prefabs |
The player cannot interact with these objects. |
Resources |
Objects that can be used as resources: logs, metal beams, concrete plates, pipes. Corresponding prefabs have the following name patterns:
Use the Physics Placer tool after placing a prefab of this type, so the object does not move in unexpected ways. |
Recyclable objects |
Objects that must be recycled before player gets resources. Corresponding prefabs have the following name patterns:
Use the Physics Placer tool after placing a prefab of this type, so the object does not move in unexpected ways. |
Quest items |
Objects that can be moved by the player and, for examle, brought to a certain area as a part of the objective. Corresponding prefabs have auto_quest_<...>_prefab in the name. Use the Physics Placer tool after placing a prefab of this type, so the object does not move in unexpected ways. |
Composite quest items |
Quest items that should be used in the Bring Quest Object To Phantom tasks. Corresponding prefabs have auto_quest_ and _composite_ in the name. When placing a composite object, always select the domain component of the objectand and move it somewhere away from the main scene. Otherwise, the object will be unusable.
Use the Physics Placer tool after placing a prefab of this type, so the object does not move in unexpected ways. |
Phantoms |
Phantoms for the Bring Quest Object To Phantom tasks. Corresponding prefabs have auto_quest_ and _phantom_ in the name. Use the Physics Placer tool after placing a prefab of this type, so the object does not move in unexpected ways. |
Puzzle objects |
Interactive objects that are generally used as parts of a puzzle. Corresponding prefabs have auto_puzzle_<...>_prefab in the name. |
Special prefabs that contain multiple prefabs, usually of the same model with different visuals (color, amount of dirt or damage, and so on). Use the Physics Placer tool after placing a prefab of this type, so the objects do not move in unexpected ways. |
|
A special prefab that can be used to make AI-vehicles move through a set of points. |
|
A special object that stores the settings of the level. |
Working with prefabs¶
-
To add a new instance of a prefab to the scene:
-
Right-click in the scene_settings or scene_art section and click Create:
Most of the time, you should add new objects in the scene_art section.
-
Find the prefab that you need and click it:
-
-
To copy a prefab, use Ctrl+C
-
To paste a prefab:
-
Use Ctrl+D to create a separate object.
-
Use Ctrl+V to create a child object.
-
-
You can drag-n-drop prefabs from the
[Packaged Content]/prefabs
folder into the Viewport (while in the Edit mode):
-
You can change the properties of an instance of the prefab (an object) in the Inspector panel.
-
To rename an instance of the prefab, right-click the instance in Outliner and click Rename:
Common properties¶
Enable/disable¶
This property is used like a flag when scripting: if the checkbox is empty, then it's treated as false
, otherwise --- as true
. Most of the objects in the game have this property. It is used to trigger scripts based on the object's Enable/Disable state.
Within the game, the value of this property can be changed by an action or by a special blueprint node.
If an object doesn't have this property, you can add it:
-
In Inspector, click
to open the full settings view:
-
Click
next to the object name, select the Enable Disable property and click Apply:
Tags¶
Tags are used to identify objects in the scene. For example, you can set up a Clear Area task so it would be complete when all objects with the tag trash are removed from the area.
To add a tag to an instance of a prefab:
-
In Inspector, click
to open full settings view:
-
Find the Tagged property:
-
If the object doesn't have tags yet, you can add a new tag in the field next to the Prop Tagged property, otherwise, click
next to the Additional Tags property and add new tag there: