How to do it...

To load game data from a text file map, do the following:

  1. Import text file level1.txt, and image file absurd128.png.
  2. Select absurd128.png in the Inspector, and set Texture Type to Sprite (2D/uGUI), and Sprite Mode to Multiple.
  3. Edit this sprite in the Sprite Editor, choosing Type as Grid and Pixel Size as 128 x 128, and apply these settings:
  1. In the Project panel, click on the right-facing white triangle to explode the icon, to show all the sprites in this sprite sheet individually:
  1. Drag the Sprite called absurd128_175 

Get Unity 2018 Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.