S2ENGINE HD  1.4.6
Official manual about S2Engine HD editor and programming
PrefabsInspector

Prefabs are the one of S2Engine HD asstype, they contains the description of one or more objects, including class they belong to, all base parameters, and all class specific parameters.
Basing on that description S2Engine HD can instantiate the objects given the prefab. To access Prefabs Inspector you can select Tools->Prefabs from main menu as showed in the following image:

prefab_tool01.jpg
Attention
In this case the prefab Inspector will open void, i.e. without any description inside it. Prefabs Inspector tool is composed by 2 panels:
  1. Prefab viewport. see also Viewports
  2. Prefabs parameters editor.
prefab_tool04.jpg

If you want to open Prefab Inspector with a prefab already loaded, or simply you want to inspect an already created prefab you must:

  • open the prefabs browser (also called objects browser)
  • click right mouse button on the icon of prefab you want to edit
  • select inspect on the appearing drop-down menu
prefab_tool02.jpg

Prefabs parameter editor lets you to edit parameters of the objects definitions inside the inspected prefab. The following is a detailed description of the prefabs panel:

  1. On the top of the panel:
    • you can save the modified prefab clicking on save button
    • you can apply the changes pressing the update button
    • you can see the prefab filename path
  2. the list objects inside the prefab. You can select the object you want to see/edit parameters.
    Attention
    you cannot modify it
  3. the class parameters of the current selected object to edit.
  4. Shapes: an object can have shapes definition for physics simulation. see Edit Shapes.
prefab_tool03.jpg
Attention
Every time you edit a parameter of the selected object click on update button to apply changes.
Note
The parameters of a prefab object are the same you can edit in the ClassInspector tool, the difference is that in the last case changes are applied directly to the object inside the scene.

Edit Shapes

Shapes are used by physics system as proxies for collision detection. They are useful when it is not possible to approximate collision using only the basic rigid body shape, see Collision Shapes and Rigid Body.

To add a new shape:

  1. click on the Add new shape.. combo box and choose box or sphere basing on the type of shape you want to add.
  2. then click on + button as showed in the following image
prefab_tool05.jpg

Once created shapes you can select the shape you want to edit from the shapes combo box as showed in the following image.

prefab_tool06.jpg

To show shapes into the prefab viewport click on colliders check box. See also Viewports .
Main collider is showed in violet color, secondary shapes are showed in orange color. The current selected shape is showed in red color and has the gizmo.

prefab_tool07.jpg

Once selected the shape you can edit by changing:

  • position: translate the shape. You can do it by manually changing values or by moving gizmo after clicking on the
    tra_icon.jpg
    icon
  • angles: rotate the shape. You can do it by manually changing values or by moving gizmo after clicking on the
    rot_icon.jpg
    icon
  • extents: scale the shape. You can do it by manually changing values or by moving gizmo after clicking on the
    scale_icon.jpg
    icon
  • restitution: it is the bouncing coefficient
  • sFriction: static friction coefficient
  • dFriction: dynamic friction coefficient

Create Prefabs From Scratch

To create a prefab from scratch:

  1. select the folder you want to create new file in the prefabs browser
  2. right click mouse button on a blank space inside the prefabs browser
  3. select new file on the appearing drop-down menu
prefab_tool08.jpg

A new dialog will appear, it will let you to select the class you want the new object must belong.

  1. select the class
  2. change the name you want to assign to the new prefab
prefab_tool09.jpg


Create Prefabs From Scene

New Prefabs can also be created from objects already existing into the scene:

  1. select the folder you want to create new file in the prefabs browser
  2. right click mouse button on a blank space inside the prefabs browser
  3. select new file from scene on the appearing drop-down menu
prefab_tool10.jpg

The pick Object Dialog will appear. This dialog lets you to select one or more object from the scene.
There are 2 lists:

  • left list: the list of selected objects
  • right list: the list of object to select inside the scene
prefab_tool11.jpg

As showed in to the above image, you can select objects in various ways:

  1. Pick Object: click on this icon and then select the object directly from scene
  2. Get selected objects: click on this icon if you have previously selected a group of objects in the scene
  3. Select from right list: you can select an object from right list and then click this icon to move it inside the left list (selected objects).
  4. Unselect objects: clicking on this icon you will move selected objects in the left list to the right list, unselecting them.

Update Prefabs From Scene

Already created prefabs can be updated in a simple way:

  1. select the file you want to update in the prefabs browser
  2. right click mouse button on the file icon
  3. select Refresh on the appearing drop-down menu
prefab_tool12.jpg

The Pick object dialog will appear. It lets you to choose objects you want to replace/update into the chosen prefab.