Tutorial

Before you begin

Make sure you have the plugin installed in your Unity Project and some prefabs to work with. Some example prefabs are included in the package in the BonaWorldEditor/Examples folder. Background

This editor was created while working on a co-op top-down game where we had to place a large amount of environmental assets into the scene in order to create a living and believable world. When placing lots of trees, rocks, fences and other assets, Unity's default tools were not quite satisfactory. Having spend several 100 hours working with the different edtitors provided with Blizzard Entertainment's games including Starcraft, Warcraft III and Starcraft II and we remeber how effortless it felt working with those editors. After that we set out with a goal: to create something in the same spirit for Unity and allowing ourselves and any other content creators to create worlds with the same ease as we used to back in the days.

Terminolgy

Some of the basic terminolgy used in the editor and that will be referred to in this tutorial.

World Editor

The editor window. Is found in Unity's menu under Window->Bona World Editor. Opens a new dockable editor window.

Asset set

A group of Asset Categories bundled together. In the editor, an Asset Set is selected and it’s categories is then available to place in the world.

Asset Category.

A collection of prefabs bundled together. The category consists of group which in turn consists of prefab items. Each group has its own section in the editor, and can be used to seperate items from each other, for visibility. A category also has a display name and may be given a shortcode. If set Shift + [control code] will switch to that category.

Placement

Once a prefab item has been selected in the editor window, a temporary placement is created in the scene, following the mouse pointer. Whenever the left mouse button is pressed, this placement will be instaciated in the scene. When a placement is active, you cannot select other objects in the sceneview.

Controls

Left-click Placed the current placement in the scene. Shift While shift is held down, the current placement is rotated towards the mouse pointer rather than moved to it. Space Releases the current placement and allows you to use the Unity editor as normal again. This can also be achieved by selecting an object in the hierarchi window. Shift + [category short code] Opens the category in the World editor window, given it exists in the selected Asset Set. Control + Z Bona’s World Editor supports undo/redo. Each seperate left-click can be undone.

Creating assets and

getting ready

First of all you need some prefabs to work to use. In the package there are a few examples included as well as some pre-built Asset Categories and a single Asset set. Use these as your reference for how to edit them or create new ones. The editor extension can work with any prefab you create in Unity.

Create an Asset Category

First you need to create an asset category. This can be done from the menu Assets->Create->Bona World Editor->Asset Category. This creates a new Asset category in your assets folder. Name it appropriately. Give the category a name in the inspector window. The name of the asset is the internal name Unity uses for it. The name set in the inspector is used for the display purposes in the editor. These are allowed the be different. If you like, give the category a shortcode. Preferrably something logical. Using Shift + [short code] will open this category in the editor, given it's in the current Asset Set.

Create a new group by writing a name in the input field named "Create new group" and press Add group. A new group with that name will be created. You are allowed to create as many groups as you like. Groups of items are grouped together when displayed in the editor. Next to each group is a "Remove" button where you can remove the group and all items it contains.

You can add new items to a group by selecting a prefab and press ”Add”. When adding an item there are some things that can be adjusted. The rotation axis can be set to a fixed value, meaning it will always be created with that value set or randomized meaning it will be set to a random value between 0-360 for each game object instanciated in the world. If more than one axis is set to random note that they are all randomized individually. The scale for each axis will be between the minimum and maximun value of a given axis. If uniform scaling is checked all axis will be interpolated the same random number between their respective minmun and maximun. If not the axis are scaled randomly individually. These settings can be edited again after an item is created.

Create an Asset Set

To create an Asset Set, click Assets->Create->Bona World Editor->Asset Set. This creates a new Asset Set to your assets folder. Add the Asset Categories you want to each Set. A category can belong to several Asset Sets.

Using the World Editor

Open the editor from Window->Bona World Editor. You will first be prompted to enter an asset set and a base object. The asset set can be any asset set you have created, or the example set supplied with the package.

The base object must be a game object in the scene and it must have a collider component. Any placed object will be childed to this game object and when placing objects a raycast is done against this game object to determine where the objects are to be placed. A simple cube/plain/quad or a terrain object works. If you are using the example scene, select the scene object named ”World”. This is a streched out cube with a box collider attached.

Once both are selected, the more of the editor will be displayed. Here you can see the current category. By pressing the category drop-down menu, you can switch between the different categories. Underneath you can see a collection of buttons, one for each prefab item in the category. Be pressing an item, you select it as the current item and a placement object appear in the scene view, at the place of your mouse pointer. When a placement is active, simly left click to place the item in the scene. Hold down shift to rotate the selection towards the mouse pointer while not moving it. Press space to release the current placement.

Under the prefab items you can see the different brush options. The different kind of brushes are

  • Single. Always places a single item in the world
  • Circle. Places items in a circle.
  • Square. Places items in a square.
The brush size determines how big the current brush is when using a circle or square brush. The brush spacing determines how far apart the individual items in a placement are from each other of using a circle or square brush. The snapping options determines if the placement are to snap in the scene. N/A means you can place object freely while 1.0 means they will snap to whole X and Y values.