Simple Onchain Interactable

To enable players to invoke a Transaction on the Stacks blockchain, via your UE5 based game, the Player should have their Wallet Connected and you've Cast the Player Principal (with server authority assuming you are developing a multiplayer game) to the Player State through the Game Instance and Player Controller. You are going to need to have Simple Interactable Actor for the player to interact with and open our UMG Widget (in our demo video case we open the WB_Nakamoto1_Interactable widget, however for Documentation we will open the WB_Simple_Onchain_Widget )

Lets create a new Blue Print Actor, named Simple_Onchain_Interactable Add a simple Cube (scale of 1,1,1) component, and Box collision component (with scale of 2,2,2 so it surrounds our cube). Like the screenshot below.

(our Cube material glows purple, the Orange wireframe Box around it is the Box collision boundary)

Select the Box component (left side), then scroll down on the Details panel (right side). Then click the + Button next to the "On Component Begin Overlap"

We are now updating the Event Graph of the Simple_Onchain_Interactable so when a player overlaps with the collision Box of our Cube actor we will open our WB_Simple_Onchain_Widget On Overlap Event, we use the "Cast to BP_PlayerCharacter" node, so we can then "As BP_PlayerCharacter" get our Player State and Player Controller. This is to ensure the accurate player is presented with the WB_Simple_Onchain_Widget UMG widget via the "Create Widget" node.

Place the new Simple_Onchain_Interactable Actor from your content drawer into your Game Level.

(Our new Simple_Onchain_Interactable is the Purple Cube)

To test, you will need to start at your Main Menu, so you can actually connect your wallet first. Then load into your Game level. Then walk up to the new Simple_Onchain_Interactable actor to trigger the Box collision on Overlap Event and open our WB_Simple_Onchain_Widget

(On overlap of Simple_Onchain_Interactable actor, you should see the WB_Simple_Onchain_Widget)

Once presented with the WB_Simple_Onchain_Widget the user can click the Send button, which will invoke the on Button click Event handling execution, as explained in the Simple Onchain Widget. Which opens the users Browser and Wallet to Confirm the transaction.