The PictureAction component, which should send an action-command to the PictureController when clicked will be added to the object. Create a new C# script in your Scripts folder named PictureAction and open it for editing. You will see the following:
File: PictureAction.cs
using UnityEngine; using HoloToolkit.Unity.InputModule; public class PictureAction : MonoBehaviour, IInputClickHandler { public PictureCommand command; protected PictureController picture; void Start() { picture = GetComponentInParent<PictureController>(); } public void OnInputClicked(InputClickedEventData eventData) { picture.Execute(command); } }
The PictureAction responds to OnInputClicked events. Using a HoloLens, these events are generated when it recognizes the user doing a finger-thumb pinch select gesture. The Start() function finds the parent PictureController. Then, when a user clicks, it simply sends its command to the controller.