Open Listing
This example contains two prefabs that allow users to open one of your listings by pressing a button.
How to Import
- Open the Example Central Window from the window from the Unity Editor Menu under "VRChat SDK > 🏠 Example Central"
- If you haven't enabled Creator Economy examples yet:
- Press the ⚙️ gear icon in the Example Central window to open the Example Central settings.
- Enable "Show Creator Economy Examples".
- Select this prefab in Example Central.
- Press the "Import" button to import the example assets into your project.
Prefabs included
- OpenListingPrefab: Includes a button to open to a listing page. Also includes a text description.
- OpenListingSimplePrefab: Includes a button to open to a listing page. Does not include a text description.
- OpenListingAndReactToPurchasePrefab: Includes a button to open to a listing page. Plays a sound effect when a given product is purchased.
- OpenListingDeluxePrefab: Includes a thumbnail, and fields for the name, type and price of the listing.
How to Use
For each prefab, you'll need to replace any ID with the ID of your own group or product.
-
Select the chosen prefab in your Unity scene.
-
Set the ID of the listing in the
Listing ID
field in the inspector window.- Find your listing ID by opening the listing section of your store and copying its ID.
-
For OpenListingAndReactToPurchase only:
- Use the UdonProducts Manager to locate the
UdonProduct
asset of the product that should play a sound effect when purchased. - Set the
Trigger Product
field to theUdonProduct
asset.
- Use the UdonProducts Manager to locate the
-
For OpenListingDeluxe only:
- Set the Thumbnail for the listing using the
Thumbnail
field in the inspector window. It's best if you use the same thumbnail that the user will see when opening your listing, but you have the ability to use any square Sprite in your project. - Set the three text lines using the
Display Name
,Type
andPrice
fields. Just like the thumbnail, it's best if these match what the user will see in your listing, but you can enter any information you like.
- Set the Thumbnail for the listing using the
- Run Build & Test!
Inspector Parameters
The prefabs have the following parameters:
OpenListing & OpenListingSimple
Listing ID
- The listing ID of the listing you want to open.
OpenListingAndReactToPurchase
Trigger Product
- TheUdonProduct
asset that triggers the sound effect when purchased.Optional Purchase Sfx
- The sound effect that plays when purchasing the product.Optional Purchase Sfx Source
- TheAudioSource
component that plays the sound effect.
OpenListingDeluxe
Thumbnail
- The sprite shown in the prefab, typically the same as the thumbnail set for the listing.Display Name
- The first line of text, typically the Display Name of the listing.Type
- The second line of text, typically the Type of the listing - Consumable, Instant, etc.Price
- The third line of text, typically the Price of the listing in VRChat Credits.