- Home /
 
               Question by 
               TomColdtree · Apr 14, 2018 at 01:27 PM · 
                eventsystembutton trigger events  
              
 
              Play on sound on a button press for every button in my game.
I know how to make a sound play when I press button by adding a method to the On Click() in the Button Script in the inspector. Is there an easier way to do this in my game with many buttons rather than doing this manually for each button? Perhaps a way to detect a Button Press or a UI change in the EventSystem. Any help appreciated.
               Comment
              
 
               
              Answer by argentummanusbeta · Apr 14, 2018 at 01:36 PM
you could rename every sound to the name of a button, so that when you get any input, it plays the sound with the input name you just called. Its still a decent amount of work, but at least you will have 5 lines of code, as opposed to 500.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                