Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var fields = GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
- List<Button> buttons = new List<Button>();
- foreach (var field in fields)
- {
- if (field.GetCustomAttribute<SerializeField>() != null && field.GetReturnType() == typeof(Button))
- {
- buttons.Add(field.Name, field.GetValue(this) as Button);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement