Splitting a Sprite Sheet
Click on a Sprite Sheet. In the Inspector window, the import
settings for the Sprite Sheet will pop up. Below are the settings you need to
change before opening the Sprite Editor to split the files.
Sprite Mode
|
|
Pixels Per Unit
|
The max-width and/or height of the largest asset
|
Filter
|
Point (no filter)
|
Max Size
|
Pick a size larger than the total width and height of the Sprite
Sheet. If the sprites are blurry, try increasing the Max Size.
|
Format
|
RGBA 32 bit
|
After all those settings are changed , click on ‘ Sprite
Editor.'
A new window will pop
up. In the top left-hand corner, click on ‘Slice’. Keep the settings as
is and click ‘Slice’. If the auto-slicer is wrong, got back into the
settings and change the ‘Type’ from ‘Automatic’ to ‘Grid By Cell
Size’.
Click on one of the sliced assets and change ‘Pivot Unit
Mode’ from ‘Normalized’ to ‘Pixels’. Click ‘ Apply’ in
the top right-hand corner when you are done –the Sprite Sheet will be sliced .
Each of the sliced assets can be dragged in individually into the Scene .
Adding Asset to Scene
An Environmental Game Asset should have a ‘Sprite
Renderer’ component already attached before placing into the game scene. If
you create a Game Object first and then add a Sprite Renderer, the sprite will
not show. To get around this odd bug, simply drag and drop a sprite from Project
window into the scene and it will work. Once the sprite is in the scene, you
can then duplicate the asset and it will still work.
A Sorting Group component allows assets to adjust its
z value based on its y position. The order layer dictates how low or high that game
object is. Each block on the grid is 8, so an object that is 2 blocks high has a height of 16.
A Game Object is comprised of three components: A sprite, a collidable
base (CB), and a non-collidable collision box (NC). A* uses the CB in pathfinding navigation, and the NC acts as both cover from projectiles and from the enemy line of sight.
- Game
Objects thatdo not need to be avoided by the AI need not include a CB. - Game Objects that are not tall enough to provide cover need not include the NC.
Prefab: A Prefab is a Game Object with pre-configured components and child Game Objects
that can be placed in a scene. Editing anything in master Prefab will be automatically
attributed to all copies of the Prefab placed in a scene.
Layer
|
Description
|
A*
|
·
Any obstacle to
·
Will automatically add the Box Collider 2D component
to the Obstacle Layer Mask (A* algorithm will use this)
|
·
|
Tag
|
Description
|
·
|
|
·
AI will determine th
·
Will obscure the line of sight of AI if
|
Example Environmental
Game Object
|
||||
Parent
|
Environment Asset
|
|||
Tag
|
Layer
|
Sorting Group: Order in Layer
|
Sprite Renderer: Material
|
|
Untagged
|
Default
|
Default: 0 (depends on
asset)
|
Default:
|
|
Child
|
||||
Tag
|
Layer
|
Box
Collider 2D: Is Trigger
|
||
A*
|
||||
Child
|
Non-
|
|||