Guest User

Untitled

a guest
Mar 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public static PersistentManagerScript Instance { get; private set; }
  2.  
  3. public string Value;
  4.  
  5. private void Awake()
  6. {
  7. if (Instance == null) {
  8. Instance = this;
  9. DontDestroyOnLoad (gameObject);
  10. }
  11. else
  12. {
  13. Destroy (gameObject);
  14. }
  15. }
  16.  
  17. // Use this for initialization
  18. void Start () {
  19.  
  20. Value = "camilo";
  21.  
  22. }
  23.  
  24. // Update is called once per frame
  25. void Update () {
  26.  
  27. }
  28.  
  29. using System.Collections;
  30. using System.Collections.Generic;
  31. using UnityEngine;
  32. using UnityEngine.UI;
  33. using UnityEngine.SceneManagement;
  34.  
  35. public class SceneManagerScript : MonoBehaviour {
  36.  
  37. public Text ValueTxt;
  38.  
  39. private void Start()
  40. {
  41. ValueTxt.text = PersistentManagerScript.Instance.Value.ToString ();
  42. }
  43.  
  44. public void GoToCategories()
  45. {
  46. SceneManager.LoadScene ("Categories");
  47. PersistentManagerScript.Instance.Value;
  48. }
  49.  
  50. public void GoToSubCategories()
  51. {
  52. SceneManager.LoadScene("subcategories");
  53. PersistentManagerScript.Instance.Value;
  54. }
Add Comment
Please, Sign In to add comment