// Grab references to both the Object and Static databases void Start() { // Since our database exists within an object in the scene, we'll need to find it. // Alternatively you could expose the database as a public member, and use the // inspector to set it. GameObject statsdbobj = GameObject.Find("databaseObj"); if (statsdbobj != null) { // Get the CharacterStats component out of the GameObject. // CharacterStats is the name of the worksheet in the google spreadsheet // that we are getting the monster information from _statsDb = statsdbobj.GetComponent <CharacterStatsSample>(); } // The Items database is a Static class. Use it by grabbing the .Instance, this will // ensure the database is correctly initialized. Larger databases may take a while // to initialize, so grabbing an instance before the game is updating is recommended. _itemsDb = ItemsSample.Instance; }
// Grab references to both the Object and Static databases void Start() { // Since our database exists within an object in the scene, we'll need to find it. // Alternatively you could expose the database as a public member, and use the // inspector to set it. GameObject statsdbobj = GameObject.Find("databaseObj"); if ( statsdbobj != null ) { // Get the CharacterStats component out of the GameObject. // CharacterStats is the name of the worksheet in the google spreadsheet // that we are getting the monster information from _statsDb = statsdbobj.GetComponent<CharacterStatsSample>(); } // The Items database is a Static class. Use it by grabbing the .Instance, this will // ensure the database is correctly initialized. Larger databases may take a while // to initialize, so grabbing an instance before the game is updating is recommended. _itemsDb = ItemsSample.Instance; }