Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Analytics;
- public class AboutResults : MonoBehaviour {
- //float to load the scene/case times into
- public int Scene1About, Scene2About, Scene3About, Scene4About, Scene5About;
- public List<int> Patharray;
- Dictionary<string, object> analytics = new Dictionary<string, object>();
- // Use this for initialization
- void Start()
- {
- //first fill the array with the path
- for (int i = 0; i <= Patharray.Count; i++)
- {
- Patharray.Add(PlayerPrefs.GetInt("Question" + i));
- }
- //Loop throgh the Patharray array
- for (int i = 0; i <= Patharray.Count; i++)
- {
- //Add each object to the Dictionary
- analytics.Add("Question" + i, Patharray[i]);
- }
- //Send the event with the Dictionary object included
- Analytics.CustomEvent("Path Taken", analytics);
- Scene1About = PlayerPrefs.GetInt("AboutClicked1");
- Scene2About = PlayerPrefs.GetInt("AboutClicked2");
- Scene3About = PlayerPrefs.GetInt("AboutClicked3");
- Scene4About = PlayerPrefs.GetInt("AboutClicked4");
- Scene5About = PlayerPrefs.GetInt("AboutClicked5");
- Debug.Log("Scene 1 About Clicked: " + Scene1About);
- Debug.Log("Scene 2 About Clicked: " + Scene2About);
- Debug.Log("Scene 3 About Clicked: " + Scene3About);
- Debug.Log("Scene 4 About Clicked: " + Scene4About);
- Debug.Log("Scene 5 About Clicked: " + Scene5About);
- //analytics outputing if the about button is pressed.
- Analytics.CustomEvent("About Button Selected?", new Dictionary<string, object>
- {
- { "Case 1", Scene1About },
- { "Case 2", Scene2About },
- { "Case 3", Scene3About },
- { "Case 4", Scene4About },
- { "Case 5", Scene5About },
- });
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void ResetPlayerPrefs()
- {
- PlayerPrefs.DeleteAll();
- Debug.Log("Player Prefs Reset");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement