Shoteror: Instructions for Adding Environment Assets

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 Mode
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.
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 that do 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.
After a fully created Environmental Game Object is completed, drag and drop the Game Object from the Hierarchy window into the Project window to create a Prefab asset that you can now use everywhere.

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.

       ·        Any obstacle to be navigated around by AI needs to be in the ‘A*’ layer
       ·        Will automatically add the Box Collider 2D component to the Obstacle Layer Mask (A* algorithm will use this)
       ·        Indicates that the Game Object is solid and will be targeted by a raycast

       ·        Indicates that the Game Object is solid, but should be ignored by raycast
       ·        AI will determine the obstacle as a solid object
       ·        Will obscure the line of sight of AI if the player is not seen

Example Environmental Game Object
Environment Asset
Sorting Group: Order in Layer
Sprite Renderer: Material
Default: 0 (depends on asset)
Default: Mat_Ground
Collidable Base
Box Collider 2D: Is Trigger
Non-Collidable Collision Box