- Home /
Custom Controls using Invoke
Hey everyone. I have set up custom controls for my game in a very roundabout and slow way so I could use some help.
Right now I have a List of buttons with a corresponding List of commands. I run a for loop that checks to see if any of those buttons have been pressed, then runs the corresponding command:
for (i = 0; i < buttonCount; i++) {
if (Input.GetButton(buttons[i])) {
Invoke (buttonCommands[i], 0);
}
}
Not only is this slow, but I can't count on Invoke to occur with each frame. Does anyone know a better way of doing this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613172513im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make custom UI controls/components using C#? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Renderer on object disabled after level reload 1 Answer
OnPointerClick not getting public variables from script 0 Answers