Home > Software engineering >  Unity Button List
Unity Button List

Time:02-19

Hey everyone I am trying to create a Button List in the parent of the buttons but when I wrote;

 public List<Button> buttonList;

I get an error how can I fix that ? I want to loop through my buttons and give them listener but like I said I can't write it this way and when I try to write it with GameObject instead of Button I can't onClick and Listener to it.

CodePudding user response:

Did you try to import UI library from Unity Engine. At the top of your script you should add:

using UnityEngine.UI;

CodePudding user response:

I added using UnityEngine.UI and it worked

  • Related