question

Michael Brilz avatar image
Michael Brilz asked

Deactivate button after purchase

I have a problem that I can't get any further. When the player buys a character, this button should be deactivated and remain so. can someone help me how i do that

Player DataPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image
Citrus Yan answered

Not sure which engine/language you are using, however, the basic idea should be similar:

In the success callback of the purchase, deactivate the button by doing this: button.interactable = false; (assuming you’re using Unity)

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Michael Brilz avatar image Michael Brilz commented ·

C Sharp with unity

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Michael Brilz commented ·

You may iterate all those 4 buttons and deactivate the ones whose associated character is in the inventory.

0 Likes 0 ·
Michael Brilz avatar image Michael Brilz Citrus Yan commented ·

how do i find out which button belongs to which character. Maybe you have a code example

0 Likes 0 ·
Show more comments
Michael Brilz avatar image Michael Brilz commented ·

that's a great tip thank you :)

0 Likes 0 ·
Brandon Phillips avatar image
Brandon Phillips answered

@Michael Brilz What engine/language are you using? If you're using Unity, it's as simple as

YourPurchaseButton.interactable = false;
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Michael Brilz avatar image Michael Brilz commented ·

I Check with getuserinventory if the character is in the inventory, but How i can deactivated the Button of this characters.

0 Likes 0 ·
Michael Brilz avatar image
Michael Brilz answered

I forgot to give more information sry. I have 4 buttons on which players can buy characters with purchase item. How can I Check After the login if these characters are in the inventory, and deactivated the button of this character

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]