コード例 #1
0
    void OnMouseUp()
    {
        if ((Input.mousePosition - mousePosWhenClicked).magnitude < 10) //prevent opening panel when trying to drag
        {
            //when clicked open the side panel and fill it with the correct information
            SidePanel sidePanelScript = GameObject.FindGameObjectWithTag("SidePanel").GetComponent <SidePanel>();
            sidePanelScript.SetInformation(Title, Description);
            sidePanelScript.OpenPanel();

            //scroll the carousel to the clicked image
            gameObject.transform.parent.gameObject.GetComponent <Carousel>().GoToImage(gameObject);
        }
    }