// Update is called once per frame new void Update() { if (Input.GetMouseButtonDown(0)) { clickPosition = Input.mousePosition; } if (Input.GetMouseButton(0)) { Vector2 currentPos = Input.mousePosition; deltaY = currentPos.y - clickPosition.y; dialogueController.setScroll(lastScroll + deltaY); } if (Input.GetMouseButtonUp(0)) { lastScroll += deltaY; if (lastScroll > dialogueController.getMaxScroll()) { lastScroll = dialogueController.getMaxScroll(); } if (lastScroll < dialogueController.getMinScroll()) { lastScroll = dialogueController.getMinScroll(); } } if (status == AlphabetState.exitting) { if (!isWaitingForActionToComplete) { if (mcRef == null) { return; } DataStorage ds = mcRef.getStorage(); string returnLevel = ds.retrieveStringValue("ReturnLocation"); if (!returnLevel.Equals("")) { SceneManager.LoadScene(returnLevel); } } } if (scrollbar.gameObject.activeSelf) { float viewportHeight = container.GetComponent <RectTransform> ().rect.height - 106; float maxHeight = conversationList.Count * 100; float scrollvalue = scrollbar.GetComponent <Scrollbar> ().value; float yPos = scrollvalue * (maxHeight - viewportHeight); Vector3 pos = container.transform.position; pos.y = Screen.height / 2 + yPos; container.transform.position = pos; } }