static void UpdateFromSpreadsheet() { UnityDataConnector conn = GameObject.Find("ConnectionExample").GetComponent <UnityDataConnector>(); string connectionString = conn.webServiceUrl + "?ssid=" + conn.spreadsheetId + "&sheet=" + conn.worksheetName + "&pass="******"&action=GetData"; Debug.Log("Connecting to webservice on " + connectionString); WWW www = new WWW(connectionString); ContinuationManager.Add(() => www.isDone, () => { if (!string.IsNullOrEmpty(www.error)) { Debug.Log("WWW failed: " + www.error); } try { JsonData[] ssObjects = JsonMapper.ToObject <JsonData[]>(www.text); Debug.Log("Data Successfully Retrieved!"); GameObject dataUseExample = Selection.activeObject as GameObject; dataUseExample.GetComponent <AdjustBalls>().DoSomethingWithTheData(ssObjects); } catch { Debug.LogError("Data error: could not parse retrieved data as json."); } } ); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
void Awake() { // First we check if there are any other instances conflicting if (Instance != null && Instance != this) { Destroy(gameObject); } Instance = this; DontDestroyOnLoad(gameObject); }