Class PurchaseButton
Component for completing a purchase using the TransactionManager.
Inherited Members
Namespace: UnityEngine.GameFoundation.UI
Assembly: solution.dll
Syntax
[AddComponentMenu("Game Foundation/Purchase Button", 3)]
[RequireComponent(typeof(Button))]
[ExecuteInEditMode]
public class PurchaseButton : MonoBehaviour
Fields
| Name | Description |
|---|---|
| m_PriceIconImageField | |
| noPriceString | The string to display if the Transaction Item has no cost. |
| onPurchaseFailure | Callback that will get triggered if item purchase fails. |
| onPurchaseSuccess | Callback that will get triggered if item purchase completes successfully. |
Properties
| Name | Description |
|---|---|
| availableToPurchaseState | Specifies whether the item is available to purchase. |
| interactable | Use to enable or disable the button. |
| priceIconImageField | The Image component to assign the Transaction Item's icon image to. |
| priceIconSpriteName | The sprite name for price icon that will be displayed on the button. |
| priceTextField | The Text component to assign the price text to. |
| transactionId | The id of the Transaction Item being purchased. |
Methods
| Name | Description |
|---|---|
| GetTransaction() | Gets the BaseTransaction that is attached to the PurchaseButton. |
| Purchase() | Calls |
| SetInteractable(bool) | Sets the button's interactable state if the state specified is different from the current state. |
| SetPriceIconImageField(Image) | Sets the Image component to display price icon sprite on the button. |
| SetPriceIconSpriteName(string) | Sets sprite name for price icon that will be displayed on the button. |
| SetPriceTextField(Text) | Sets the Text component to display price text on the button. |
| SetTransactionId(string) | Updates which Transaction Item should be displayed by this button. |