/Comfy-Google-Sheets

Comfy Google Sheets is a Unity package that facilitates easy pushing and pulling engine assets data to/from Google Sheets.

Primary LanguageC#

[WIP] Comfy Google Sheets

License: MIT

About

Comfy Google Sheets is a Unity package that facilitates easy pushing and pulling engine assets data to/from Google Sheets.

⚠️ Currently asset in WIP stage! Can contains bugs and dirty, unoptimized code!

Overview

Comfy Google Sheets simplifies the process by providing an easy-to-use interface that integrates directly with Google Sheets.

Make a simple row converter, select multuple scriptable objects, and push it into google sheet! Then, make your mass assets changes, using table formulas and other things, and pull all data back into your engine assets!

This tool perfectly fits into your workflow and improves the speed and efficiency of your game development, making it even comfier!

Little Demo:

chrome_Bw9O3d2bu9.mp4

Minimum Requirements

Install via GIT URL

Go to Package Manager -> Add package from GIT url... -> Enter https://github.com/fffogil/Comfy-Google-Sheets.git -> Click Add

You will need to have Git installed and available in your system's PATH.

Usage

After installing, you will see the ComfyGoogleSheets folder in your Packages folder.

To use Comfy Google Sheets:

  1. Do not forget to install Google APIs Library into your unity project

  2. Create service account in your Google API panel, download json credits and share table with service account. Its simple! More explanation in this YouTube video

  3. Create GoogleSheetsCredits asset, and fill it

  1. Describe your assets serializing/deserializing behaviour in one of these ways:

    • Mark fields with TableRowValue attribute
    • Implement ITableRowConverter interface in your asset classes
    • Or create any additional class anywhere in your project, and implement IExternalAssetTableRowConverter interface for it. (This can be used for serialize classes that you cannot edit)
  2. Create ComfyGoogleSheetsAssetsContainer scriptable object anywhere in project, select prepared credits, table, assets, and continue make your game!

That's all! Start manipulating your engine assets data in a more comfy way.

Code sample

Its my ITableRowConverter interface implementation for creature statistics data asset

        // Collect stats and make TableRow object from it
        public TableRow SerializeToTableRow()
        {
            return new TableRow(name, stats.Select(stat => new TableRow.ValuePair(stat.GetType().Name, stat.BaseValue.ToString())));
        }

        // Take TableRow object, read it, and set stats values
        public void DeserializeFromTableRow(TableRow row)
        {
            foreach (var valuePair in row.Values)
            {
                var statName = valuePair.columnName;
                var stat = stats.FirstOrDefault(x => x.GetType().Name == statName);
                if (stat == null) continue;
                
                stat.GetType().GetField("baseValue", BindingFlags.NonPublic | BindingFlags.Instance)
                    .SetValue(stat, float.Parse(valuePair.value));
            }
        }

License

MIT License

Copyright (c) 2022 Ligofff

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.