Closing the Panel

Implementation of Closing Panel would be a small exercise for you to consider using Gaze and Gesture; we will try to keep this short and simple here:

  1. Add a box collider with the cross images inside the panel.
  2. Add a new script called DialogCloseHandler.cs inside the Script folder.
  3. Open the class in Visual Studio and implement the InputClickHandler interface.

Add the following line of code inside the OnInputClicked() method that just takes reference of the DetailsPanel Game Object and sets the alpha to its CanvasGroup's renderer components to 0:

public void OnInputClicked(InputEventData eventData)
{
GameObject detailsPanel =
GameObject.FindWithTag("DetailsPanel");

if (detailsPanel != null)
{
CanvasGroup detailsPanelRenderer =
detailsPanel.GetComponentInChildren<CanvasGroup>();
detailsPanelRenderer.alpha = 0;
}
}

Finally, attach the script with Close image control from the Inspector windows. That's it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.50.185