Reviewing code
As you can see from the previous setup exercise and through testing, the Inventory service we imported already has the database wrapper attached. Let's review some of the script changes we imported and also get into details of the InventoryService
script:
- Double-click on the
CatchSceneController
located in theAssets/FoodyGo/Scripts/Controllers
folder in the Project window to open the script in the editor of your choice. The only thing that has thus far changed in the
CatchSceneController
is a new Start method calling ourInventory
service. Perform the following reviewing method:void Start() { var monster = InventoryService.Instance.CreateMonster(); print(monster); }
- Inside the
Start
method, theInventoryService
is being called as a singleton using theInstance
property. Then, theCreateMonster
method is called to generate a newmonster
object. Finally, themonster
object is printed to the Console...