# Cost Button

## How to use

* Create button object ([Vibro Button](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/ready-to-use-scipts/vibro-button) recommended);
* Add Cost Button to it;
* You can set "*Self Set Cost Data On Init*" true so button will be inited with Cost from inspector,\
  or leave false and init it in your game controllers (UI or something);
* &#x20;"Center Text And Icon" set to true so icon and text will be centered like if you use [TextWithIcon ](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/ready-to-use-scipts/texthandler)script;
* Suscribe to "OnClick" event from CostButton.cs in your controller to spend currency and reflect user action in SaveData or something else. \
  You can spend currency with Buy() method from CostButton.cs;

If you need to color text or apply some effects (button sprite change or something else) you can use *<mark style="color:purple;">**CostButtonEnhanced.cs**</mark>* which is inherited from ***CostButton.cs***.
