Hi
I am making an item shop with GUI buttons.
Would you suggest writing a script that has a switch statement for all possible cases and attaching it to an update function and putting each script on each item button, or should I write a script that detects the mouse and checks it vs. every button via a “item shop” container?
Or is there a 3rd method that’s even more efficient that you can suggest?
Hey,
When I have previously made shop GUI’s I used OnGUI to render out button’s. You can customize there look with GUIStyle. Then I create if statements around the buttons that call a function to do a specific thing like so,
public GUIStyle Start_Button;
if( GUI.Button(new Rect(100, 100, 150, 50), "", Start_Button))
{
FunctionBuySomething();
}
I know this is C# but if you use JavaScript then it is easily applicable and I’m sure you get the idea!