Class InventoryResetAndInitialAllocationSample
Inheritance
InventoryResetAndInitialAllocationSample
Syntax
public class InventoryResetAndInitialAllocationSample : MonoBehaviour
Fields
References to the remove buttons to enable/disable when the action is not possible.
Declaration
public Button addAppleButton
Field Value
Declaration
public Button addOrangeButton
Field Value
Declaration
public Button deleteAndReinitializeButton
Field Value
gameFoundationInit
Reference in the scene to the Game Foundation Init component.
Declaration
public GameFoundationInit gameFoundationInit
Field Value
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
Field Value
Declaration
public Button removeAllButton
Field Value
Declaration
public Button removeAppleButton
Field Value
Declaration
public Button removeOrangeButton
Field Value
Methods
AddItem(String)
Adds a single item to the main inventory.
Declaration
public void AddItem(string itemDefinitionKey)
Parameters
Type |
Name |
Description |
String |
itemDefinitionKey |
|
DeleteAndReinitializeGameFoundation()
Uninitializes Game Foundation, deletes persistence data, then re-initializes Game Foundation.
Note: Because Game Foundation is initialized again, all Initial Allocation items will be added again.
Declaration
public void DeleteAndReinitializeGameFoundation()
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()
RemoveAllInventoryItems()
Removes all items from the inventory WITHOUT reinitializing.
Declaration
public void RemoveAllInventoryItems()
RemoveItem(String)
Removes a single item from the main inventory.
Declaration
public void RemoveItem(string itemDefinitionKey)
Parameters
Type |
Name |
Description |
String |
itemDefinitionKey |
|
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.