Advertisement
Guest User

Untitled

a guest
Mar 5th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  1. var fields = GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
  2. List<Button> buttons = new List<Button>();
  3.  
  4. foreach (var field in fields)
  5. {
  6.     if (field.GetCustomAttribute<SerializeField>() != null && field.GetReturnType() == typeof(Button))
  7.     {
  8.         buttons.Add(field.Name, field.GetValue(this) as Button);
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement