- Home /
Creating a list of buttons that can be scrolled left and right?
Hi all, I have to create the left and right arrows which can be clicked to scroll through a list of menu options. The list should be clickable buttons.
Per button click I want to scroll one item in from the left or right depending on the user click the right or left scroll button.
Please help me to get this done.
Thanks in Advance.
Will the menu actually move as the player scrolls, or will there be a highlighting effect of some kind that moves from one button to the next?
The button scrolls as per the player clicks on left or right scroll button.
I tried like this
if(GUI.Button(new Rect(10,150,100,30),"LEFT"))
{
m_left = true;
m_left1 = true;
m_left2 = true;
m_i++;
}
GUI.Button(new Rect(x,150,100,50),"flower");
GUI.Button(new Rect(x1,150,100,50),"fauna");
GUI.Button(new Rect(x2,150,100,50),"land");
if(m_i == 1)
{
if (m_left)
{
x -= Time.deltaTime * 50;
//Debug.Log (x);
}
if (m_left1)
{
x1 -= Time.deltaTime * 50;
x2 -= Time.deltaTime * 50;
//Debug.Log (x1);
}
if(x<= -100.0f && m_i == 1)
{
m_left = false;
}
if(x1 <= 250.0f && m_i == 1)
{
m_left1 = false;
}
}
But I need this as a generic code since I have a list of button in the scroll.
Thanks for your reply.
Your answer
Follow this Question
Related Questions
Need more buttons to this script. 1 Answer
Transform translate 1 Answer
Is this how i do a Button activated teleporter. 1 Answer
problem when clicking on Button 0 Answers