Unity supports 2D projects as well as 3D projects.
When working on a 2D game or application
workflow can be improved by marking the project
as a 2D project in the Editor settings,
and setting the scene view in the editor mode
to 2D mode.
When starting a new 2D project
these can be preset in the new project wizard
by selecting Setup Defaults For 2D.
If a project has been preset as 2D
when the new project opens it will have
it's editor settings and scene view configured
for a 2D project.
This means that the scene view will be in 2D mode
and the default editor mode will be set to 2D.
It is important not to confuse the 2D
editor mode with the 2D scene view mode.
The editor mode describes how the editor
will treat the project.
The 2D scene view mode simply switches between the
2D and 3D views of the scene.
Importantly these 2 settings are independent of each other.
The scene view mode is indicated in the editor
with the 2D mode button in the header bar.
With this button we can toggle the editor
between 2D and 3D mode.
The editor mode can be changed at any time.
o view or change the editor settings select Edit -
Project Settings -
Editor.
The editor setting that related to a 2D
project is Default Behaviour mode.
When Setup Defaults For 2D is selected
in the new project wizard the wizard sets default
behaviour mode to 2D.
When default behaviour mode is set to 2D,
and a new scene is created,
the default camera will be set as orthographic,
with an orthographic size of 5.
When a new image is imported, the default texture imported
will be set to the texture type of
sprite rather than texture.
For more information on textures,
the texture importer and cameras,
including the orthographic camera,
please see the information linked below.
When working on a project it is important to note
that the scene view mode will not effect the
game being built in the editor.
It is possible to make a 2D game with
2D optimised game objects
while the scene view is in 3D mode.x
It is possible to mix both 2D and
3D elements in the same game.
Having the scene view in 2D mode however
can help improve the workflow of a 2D project
and makes working with 2D optimised game
objects much easier.
When the scene view is in 2D mode
there will be some noticeable changed to the scene
view compared to 3D mode.
In 2D mode the scene view is locked in an orthographic
non-perspective view, looking along the Z axis
towards the X/Y plane.
The X axis is aligned horizontally
and the Y axis is aligned vertically
with positive values up and to the right
and negative values down and to the left.
In 2D mode there is no ability to
rotate the scene view camera
so in 2D mode the scene gizmo is hidden.S
To navigate the scene and position game objects
in the scene there are transform tools in the menu bar.
These tools are the Hand tool,
the Translate tool,
the Rotate tool and the Scale tool.
In 2D mode the primary tool will be
the Translate tool.
These tool buttons can be selected by clicking on them
or by using a shortcut key.
The shortcut keys for these buttons are the
Q, W, E and R keys.
An easy way to remember these shortcut keys
is that the transform tools are the buttons
in the upper left of the editor
and the shortcut keys are the keys in the
upper left of the keyboard, and they are
in the same order, left to right.
Q is the shortcut key for the hand tool.
W is the shortcut key for the translate tool.
E is the shortcut key for the rotate tool
and R is the shortcut key for the scale tool.
The hand tool moves the scene view.
Click and drag anywhere in the scene to move the view.
The hand tool can be modified by using
the control keys to zoom the scene view.
It's useful to note that the hand tool
can be used when any of the other transform
tools are active by holding down either the
Alt or Option key.
The zoom tool can also be used when any
of the other transform tools are active by
holding down both the control and either the
Alt or Option keys.
The right mouse button can also be used
to activate the hand tool
and the mouse wheel can be used to zoom.
The translate, rotate and scale tools
are used to select and position
game objects in the scene.
With any of the transform tools active
click on a game object to select it.
When selected a gizmo will appear
around the game object.
Each tool has it's own gizmo and the
gizmo will change when the tool is changed.
The translate tool is for moving game objects in the scene.
When a scene view mode is set for 2D
the translate tool can also be used to
scale and rotate sprites.
If the game object is a sprite and the scene view
is in 2D mode, the translate gizmo
is replaced by the sprite gizmo.
The sprite gizmo adds additional functionality
to the translate tool and improves
the 2D workflow.
When working with sprites in 2D mode
it is possible to work exclusively with the translate tool.
The sprite gizmo can be used to position the
sprite in the scene by clicking and dragging
anywhere within the area of the sprite gizmo.
The sprite gizmo can also be used to
rotate or scale the sprite.
To rotate a sprite using the translate tool
click and drag on a point outside of the
sprite gizmo near one corner.
This point is indicated by the
rotate icon appearing on the pointer.
To scale a sprite using the translate tool
click and drag on either the corner
or the edge of the sprite gizmo.
This is indicated by the pointer icon
changing to a double arrow icon
which will be oriented in the direction the
sprite will scale when dragged.
By default the sprite will scale proportionally.
To scale the sprite disproportionally
hold the Shift key while dragging on an edge
or corner of the sprite gizmo.
When rotating, holding the Shift key will step
the rotation in 15 degree increments.
The rotate and scale tools are used
to rotate and scale the selected game object,
and their behaviour is unchanged in 2D mode.
For more information on transform tools,
including the rotate and scale tools,
please see the information linked below.
The order in which sprites are rendered
depends upon details controlled by the
sprite renderer and it's sorting layers.
For more information on the sprite renderer
component and sorting layers
please see the information linked below.
Subtitles by the Amara.org community