Become - Unity 2d Graphical Elements PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Unity 2D Graphical Elements Cheat Sheet

by Become A Game Developer (become) via cheatography.com/67591/cs/17128/

Assets Sprites (cont) Sprites (cont)

Assets Resources you can use in your Texture Inspect an image asset to change its Sprite Select the Sprite Asset > click Sprite
game. Images (bmp, tif, tga, jpg, modes Texture Mode. "​Sprite (2D and UI)" Editor Editor in the Inspector. Allows the
psd), models (fbx, max, blend, mb, is the default mode for images in 2D extraction of single sprites from
ma), meshes, audio projects. "​Tex​tur​e" is the default for sprite​sheets (be sure to set the Sprite
images in 3D projects. "​Tex​tur​e" Mode of your asset to "​Mul​tip​le"
Standard Basic assets that either ship with
assets Unity instal​lation or can be assets are meant to be drawn on 3D before). In the editor you can access
models, "​Spr​ite​"s are meant to be the Slice menu at the top left, which
downloaded from the Asset Store
standalone 2D images allows you to separate the images
Asset Library of free and paid
automa​tic​ally. Unity will draw a crop
Sprite​s Image file containing severa sub-
Store downlo​adable assets (textures,
rectangle outside each image. You
heet images on a transp​arent
models, animat​ions, project
can select them to tweak properties
backgr​ound. Ex: image containing all
examples, editor extens​ions,
frames for a 2D animation. When and to set the name with which that
tutori​als). Access from the editor:
importing a sprite​sheet as an asset, Sprite will be exported. Click Apply to
Window > General > Asset Store
confirm, Revert to discard. You can
set (in the Inspector) Sprite Mode to
Asset Archive of assets that can be also use the Sprite Editor to change
"​Mul​tip​le"
package imported in your project. Can be polygons (place​holder sprites)
standard (supplied with Unity) or Sprite 1) Creator (creates placeh​older

custom (made by users) Tools sprites)


2) Editor (extracts sprites from
Import From the editor: Assets > Import
spritesheets)
packages Package
3) Renderer (Component that
Import Right click on the Project view > displays images)
assets Import New Asset. Or drag the 4) Packer (to optimize video memory
asset (for example, an image) from perfor​mance)
the computer to Project
Sprite From the editor: Assets > Sprites. It
Inspect Click on the asset in the Project Creator allows to create polygon Sprite
assets view > the Inspector will show its Assets that you can use as
properties placeh​olders in the Sprite​Ren​derers
in your Game Objects
Sprites

Sprite 2D graphics object

Sprite Image imported as asset, with


Asset Texture Mode (in the Inspector) set
to "​Sprite (2D and UI)"

Importing In a 2D project, importing an image


Sprite as asset automa​tically imports that
Assets as a Sprite Asset

By Become A Game Developer Published 20th September, 2018. Sponsored by Readability-Score.com


(become) Last updated 20th September, 2018. Measure your website readability!
cheatography.com/become/ Page 1 of 2. https://readability-score.com

becomeagamedeveloper.github.io/site
Unity 2D Graphical Elements Cheat Sheet
by Become A Game Developer (become) via cheatography.com/67591/cs/17128/

UI UI (cont) UI (cont)

UI Graphical User Interface element RectTr​a Component used for UI Elements in Text Label displaying some text
Element (text labels, buttons, on-screen nsform place of the Transform, to set Image Displays a Sprite Asset. You
sprites, health bars, ammo count, position, rotation, scale, width &
can change colors and Image
sealth​ome​ters, etc). Repres​ented by height of the rectangle, Pivot,
Type (how the Sprite will
Game Objects with particular kinds Anchor
appear inside the UI Rectangle)
of Components
Pivot Point around which rotations and Rect Mask Restricts the children elements
Canvas Game Object with a Canvas scaling occur. Shown as a blue ring. 2D to the shape of this element
component. All UI Elements should It can be moved with the mouse if
(parent)
be children of it. Shown as a the editor's toolbar pivot button is
API
rectangle in the Scene. Double click set to "​Piv​ot" mode. Or it can be set
on it in the Hierarchy to focus the when choosing the Anchor preset Reference UI Components are exactly like
Scene on it from the RectTr​ansform by keeping UI other Compon​ents. For each of
SHIFT presesd Components them, there exists a class with
Create From editor: Game Object > UI >
the same name, that you can
UI (choose the one you want). Or from Anchor Shown as 4 small triangular
use as a type to store a
Element the Hierarchy: Right click > UI > handles. It represents the point (of
reference to the Component in
(choose one). If a Canvas is not this element's parent UI Element) to
present, it will be automa​tically which this element is anchored: if Scripts.

created, and the UI Game Object will that point moves (when modifying Ex: public Text myLabel;

be added as a child the parent's RectTr​ans​form) this myLa​bel​. Access the text member to
element (child) will move
Draw Elements on Canvas are drawn in text = change a label's text. You can
accord​ingly. Can be set by choosing
order the same order in which they appear _cur + " set it to any string. You can
in the Hierarchy an Anchor preset from the concat​enate strings and values
/ " +
RectTr​ans​form. You can also set the using +
Rect Tool in the editor toolbar used to _max + "
4 triangles apart. This will make the
Tool manipulate the size of UI Elements
child stretch when the parent is HP";
(all being repres​ented as
resized
rectan​gles) UI manual:
UI Visual Compon​ents https:​//d​ocs.un​ity​3d.c​om​/Ma​nua​l/U​ISy​ste​m.html

By Become A Game Developer Published 20th September, 2018. Sponsored by Readability-Score.com


(become) Last updated 20th September, 2018. Measure your website readability!
cheatography.com/become/ Page 2 of 2. https://readability-score.com

becomeagamedeveloper.github.io/site

You might also like