O'Reilly logo

Virtual Reality Blueprints by John Williamson, Charles Palmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Image selector

The ImageSelector script will use GetMouseButtonDown and a Graphic Raycaster to determine if the user has selected one of the Preview GameObjects. If these two events are simultaneously true, then the image associated with the Preview GameObject will be assigned to the FullImage GameObject. In the following steps, we'll create the ImageSelector script, which will then be applied to the Preview GameObjects:

  1. Double-click the ImageSelector script in the Project/Scripts directory to open it in the default editor.
  2. The first step is to let Unity know what components are going to be used in the script. Since we'll be checking to see if the Raycaster collides with a UI element, we'll need the UnityEngine.UI and UnityEngine.EventSystems ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required