Learn how to save data to Google Spreadsheet from Unity 3D to save user and game data without using any plugin or SDK. With help of this tutorial you can create survey apps, newsletter subscription and many other ideas on your Unity App without having to worry for databases. Store all the information on Google Sheet from Unity.
Difficulty Level : Beginner
Total Time for Project: 15 minutes
Extra Skills:
- Browser Inspect Element or View Source code and Find (Ctrl + F)
- Google Forms
Github: https://github.com/luzan/Unity-Google-Spreadsheet
StackOverflow: https://stackoverflow.com/q/44200938/1939163
How to save data to Google Spreadsheet from Unity 3D
Basic Workflow:
Here we’ll be creating a Google Form that will save the responses to the Google Spreadsheet an using few tricks we will replicate that form into our Unity App, so that the data to the Google Form will now be feed from Unity App.
So, our first step is to create a Google Form. Login to Google Forms with Google Account and create a Google form. New Google Form will have fields and entries that are similar to what you are trying to keep on unity app.
After creation of Form, start a Unity Project and create similar form on the 2D Canvas by adding Input Fields. This is my form in Unity.
Now, add the script to the Canvas Component.
C# – Save Data to Google Sheet
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class SendToGoogle : MonoBehaviour { public GameObject username; public GameObject email; public GameObject phone; private string Name; private string Email; private string Phone; [SerializeField] private string BASE_URL = "https://docs.google.com/forms/d/e/1FAIpQLSeAC0CYd1m9hvphv28eSv-ot4lZpszLDUmQa_B76vAEjZ-6Ow/formResponse"; IEnumerator Post(string name, string email, string phone) { WWWForm form = new WWWForm(); form.AddField("entry.1673653496", name); form.AddField("entry.1422402232", email); form.AddField("entry.1022174842", phone); byte[] rawData = form.data; WWW www = new WWW(BASE_URL, rawData); yield return www; } public void Send() { Name = username.GetComponent<InputField>().text; Email = email.GetComponent<InputField>().text; Phone = phone.GetComponent<InputField>().text; StartCoroutine(Post(Name, Email, Phone)); } }
Up to this step, every component of the UI should be connected to the script, and you are ready to go.
Few things on the scripts are achieved from Source Code of the Google Forms, to get that follow these steps.
- Right click Google Form Page and click View page source (CTRL + U)
- Press CTRL + F to find, and type “form action” from here you’ll get BASE_URL.
- Now we need to get entry fields, on same page search for “input type=”text” “, and copy the data inside attribute name (Tip: starts with entry.NUMBER). Remember type can vary for every field according to the type you select during form creation. eg. entry.1673653496
Now, App is ready to run. Watch video for more detailed information.
play youtube
play youtube
xvideos
xporn
Phim sex
What Vaccines Do Dogs Need Annually
Wordle Jan 19
What Is Threshold Amount
My Pet Frame
Box Score For World Series
Louisville Women S Basketball Roster
Apple Savings Account Cons
Cso Criminal Search Bc
What Were Kleenex Tissues Originally Used For
Mens All Birds
Is Better Call Saul Over
Waitrose Warwick Way
Usd To Rm
How Much Is A Fitbit
Civil Liabilities Definition
What Is A Fast Internet Download Speedhulk Smash Birthday Cake
Waitrose Warwick Way
Rabies Vector Species
Gonzo Move
What Is The Sherman Act