5 Building a Memory game using Unity’s 2D functionality

This chapter covers

  • Displaying 2D graphics in Unity

  • Making objects clickable

  • Loading new images programmatically

  • Maintaining and displaying state by using UI text

  • Loading levels and restarting the game

Up to now, we’ve been working with 3D graphics, but you can also work with 2D graphics in Unity. So in this chapter, you’ll build a 2D game. You’re going to develop the classic children’s game Memory: you’ll display a grid of card backs, reveal the card front when it’s clicked, and score matches. These mechanics cover the basics you need to know to develop 2D games in Unity.

Although Unity originated as a tool for 3D games, it’s used often for 2D games as well. Unity has had built-in ...

Get Unity in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.