Making textures from screen content
If you want your game or player to take in-game snapshots and apply them as textures, this recipe will show you how. This can be very useful if you plan to implement an in-game photo gallery or display a snapshot of a key moment at the end of a level (racing games and stunt simulations use this feature a lot). For this particular example, we will take a snapshot of a framed region of the screen and print it in the top-right corner of the display:

Getting ready
This recipe adds to the scene created in the first recipe of this chapter, so make a copy of that project folder and do your work for this recipe with that copy.
How to do it...
To create textures from screen content, follow these steps:
- In the
Hierarchy
, create a new UI Image named Image-frame by choosing the following from the Hierarchy panel menu:Create
|UI
|Image
. Since this is the first UI GameObject to be created in this Scene, newCanvas
andEventSystem
GameObjects should be created automatically...