Finalizing user interaction
To complete our project, we will need to add two final components. These components will facilitate selecting an image for preview and providing visual feedback during the selection process.
Add the Graphic Raycaster component to the Preview
objects. If you run the Scene, you will notice that our Swipe
functions work as designed, but the user can not select a preview image for display. This is because our Preview
thumbnail objects are looking for a Graphic Raycaster, but none is present; let's fix that:
- Select
Preview (1)
throughPreview (5)
in the first GalleryPreviewHolder
. - Click on
Add Component
in theInspector
window. - Search for
Graphic Raycaster
and apply it to the selected GameObject. - Repeat this process for each of the Gallery
PreviewHolders
. - Hit click on the Play button to test the interaction. While the scene is running, click on the
Preview
thumbnails to view a larger version of the image. - Save the scene and Unity project.
- Navigate to
File
|Save Scene
to...