Class InventoryWithQuantitySample
This class manages the scene and serves as an example for inventory basics.
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class InventoryWithQuantitySample : MonoBehaviour
Fields
addAppleButton
References to the remove buttons to enable/disable when the action is not possible.
Declaration
public Button addAppleButton
Field Value
Type | Description |
---|---|
Button |
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
public Text mainText
Field Value
Type | Description |
---|---|
Text |
removeAllApplesButton
Declaration
public Button removeAllApplesButton
Field Value
Type | Description |
---|---|
Button |
removeAppleButton
Declaration
public Button removeAppleButton
Field Value
Type | Description |
---|---|
Button |
Methods
AddApple()
Adds a single apple to the GameFoundationSdk.inventory.
Declaration
public void AddApple()
OnGameFoundationException(Exception)
If GameFoundation throws exception, log the error to console.
Declaration
public void OnGameFoundationException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception thrown by GameFoundation. |
OnGameFoundationInitialized()
Once Game Foundation completes initialization, we enable buttons, setup callbacks, update GUI, etc.
Declaration
public void OnGameFoundationInitialized()
RemoveAllApples()
Removes all instances of apple InventoryItemDefinition from the Inventory.
Declaration
public void RemoveAllApples()
RemoveApple()
Removes a single apple from the main inventory.
Declaration
public void RemoveApple()