There are multiple ways to create new objects in the scene. Dropping an asset or built-in type from the Blocks view. Or pasting an object (including those from other scenes).
Also, following a set of rules, the editor determines (or create) the parent for the new object.
Blocks view integration
When the Scene Editor is active, the Blocks view shows the “blocks” you can get and drop into the scene, to create new objects. These are the blocks:
- Built-in types. Phaser types and other Phaser Editor related types.
- Assets defined in the Asset Pack file, like images, spritesheet frames, animations, spine animations, etc...
- The prefabs you created.
The first items shown in the Blocks view are the primitive object types supported by the Scene Editor. You can drag on type on drop it into the scene to create an instance of the type, with the default values.
In case of images, sprites or tile-sprites, the new instance does not contain a texture. If you want to set a texture to the object, you can select one in the Texture section.
However, if you drop an image or texture frame into the scene, the editor creates a new Image object and sets the dropped texture as the object’s texture.
Maybe, instead of an Image, you need to create a TileSprite with the same texture, in that case, you can just convert it to a TileSprite.
If you drop a BitmapFont, the editor creates a Bitmap Text.
If you drop a Prefab, the editor creates an instance of it.
The context menu shows different options for grouping the assets: by type, by Asset Pack file, and by file location:
Also, the Blocks view’s tab, shows “tab sections” which you can select for filtering the content:
Notice that there are three options:
Built-in: only the built-in types are shown in the view.
Prefabs: only the prefab files are shown.
Assets: only the assets defined in Asset Pack files are shown.
Add built-in object from context menu
The Scene Editor’s context menu shows different options for creating a new built-in object.
The Add Object sub-menu shows all categories of the built-in object types:
Also, the Add… (A
) option opens a dialog with all the built-in types. That’s great for quickly adding a new object:
Automatic parenting of new objects
When a new object is created (by dropping a block, or by pasting the object) a set of rules are evaluated to determine the parent of the new object:
- If there is an object selected in the scene:
- If it is a container, then the new object will be added to it.
- Else, if it has a parent container, then the new object will be added to the parent.
- If the scene is a prefab scene:
- If the scene is empty, the new object is added to the scene.
- If the root object is a container, then the new object will be added to it.
- Else, a new container is created and the old root object and the newly added object will be added to the new container. So the scene will have a new root object: the automatically created container.