To load game data from a text file map, do the following:
- Create a new Unity 2D project.
- Import the level1.txt text file and the absurd128.png image file.
- Select absurd128.png in the Inspector window and set Texture Type to Sprite (2D and UI) and Sprite Mode to Multiple. Then, click the Sprite Editor button to open Sprite Editor.
- In Sprite Editor, click the Slice dropdown option, then for Type choose Grid by Cell Size and set Pixel Size to 128 x 128. Then, click the Slice button to apply these settings:

Figure 13.10 – Slicing the sprite sheet into a grid of 128 x 128 pixel images
- In the Project window, click on the right-facing white triangle to explode the icon to show all the sprites in this sprite sheet individually:

Figure 13.11 – All the individual 128 x 128 sprites in the Project window
- Drag the sprite...