Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: PabloAM on May 17, 2013, 11:16:46 AM
-
Hello, I find out about that chat example has scroll but only with Scroll whell of the mouse.
Any idea how to do the scroll but with touch?
Cheers!
-
u can refer to Example 7 - Scroll View (Panel)
-
u can refer to Example 7 - Scroll View (Panel)
I tried to do it from that example. But that doesn´t work, I cant move the Text List.
The thing is that I can clip it and the ScrollBar makes more little, but I can´t get it and scroll it :(
Any idea why?
Thanks!
-
private bool isTouch = false;
public UITextList _chatList;
void Update()
{
#if (UNITY_ANDROID || UNITY_IPHONE)
foreach (Touch touch in Input.touches)
{
if ((touch.phase == TouchPhase.Began))
{
isTouch = true;
}
if (touch.phase == TouchPhase.Ended)
{
isTouch = false;
}
}
#endif
}
void LateUpdate()
{
if (isTouch)
{
_chatList.OnScroll((float)System.Math.Round(-Input.GetAxis("Mouse Y") / 5, 1));
}
}
Make function OnScroll public in script UITextList.cs
-
Thanks you very much vip_prizrak_3.
I didn´t try because I have find out why that didn´t works with the example 7.
That was because Text list didn´t have "UIDrag Panel Contents" script and a Box collider on it.
Now works, but your script looks better in order to avoid all that work and just get the touch if is from a mobile device.
Good job! :)
Thanks