- Home /
Change the material of a buttons in List and keep it by draging around the screen?
Hello dear people,
Please, i have a problem .I hope, you could help me.
I try to change the material (in image(script)) of buttons, that are saved in a public List by scripting. I have created a public list of material and add some created materials into it. [0]: MatBlue; [1]:MatCyan
I have 2 separated buttons. What i want to do: touch a button in the list , change its material, drag the finger (and keep the pressed material of the first button, since the finger didnt leave the screen) to another button and also change its material (here, cause it would be also pressed) , and now when i release the touch, meanings remove the finger from the screen, the buttons get back to their previous respective material or colors.
I dont know know how i can check, if the button in List of buttons is pressed or not,
Please how can i achieve this by coding THanks
Hello, How can i check if a button is pressed in a list of buttons?
public List<Button> listOfButtons; // Contains 5 elements
void start() {
}
public void pressedButton { // i press the second element of listOfButtons on the screen
if (secondElementPressed){
//Do Something
}
}
Thnaks for help
Answer by CoreApp2 · Jan 22, 2018 at 12:16 PM
I have tried it with delegates and event systems and it works now fine. I found this video, where it is explained with examples.
Your answer
Follow this Question
Related Questions
GUI Button touch problem 1 Answer
Taking Input from Android phones 1 Answer
Using Sprite as Button 2 Answers
Continuous shooting by holding iPhone button 2 Answers
[closed]OnClick with touch 1 Answer