Advertisement
Pro_Unit

ButtonLineDrawer

May 4th, 2023
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. using System;
  2.  
  3. using UnityEngine;
  4.  
  5. namespace Game.Utilities
  6. {
  7.     public class ButtonLineDrawer : IRectLineDrawer
  8.     {
  9.         private readonly string _name;
  10.         private readonly Action _action;
  11.  
  12.         public ButtonLineDrawer(string name, Action action)
  13.         {
  14.             _name = name;
  15.             _action = action;
  16.         }
  17.  
  18.         public void Draw(Rect position)
  19.         {
  20.             if (GUI.Button(position, _name))
  21.                 _action?.Invoke();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement