πͺCost Button
Used to responce on player currency enough or not enough by changing interactible state, contain Cost. It will change currency icon from config at runtime.
How to use
Create button object (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);
"Center Text And Icon" set to true so icon and text will be centered like if you use TextWithIcon 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 CostButtonEnhanced.cs which is inherited from CostButton.cs.
Last updated