Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. void Awake() {
  2. DontDestroyOnLoad(transform.gameObject);
  3. }
  4.  
  5. using UnityEngine;
  6. using System.Collections;
  7. using UnityEngine.UI;
  8.  
  9. public class DontDestroyScriptBetweenSceens : MonoBehaviour {
  10. public static int points = 100;
  11.  
  12. void Awake() {
  13. DontDestroyOnLoad(transform.gameObject);
  14. }
  15.  
  16. void OnLevelWasLoaded(int level) {
  17. Text ui = GameObject.Find("/Canvas/Text").GetComponent<Text>();
  18. Debug.Log("scene was loaded");
  19. }
  20. }
  21.  
  22. using UnityEngine;
  23. using System.Collections;
  24. using UnityEngine.UI;
  25.  
  26. public class DontDestroyScriptBetweenSceens : MonoBehaviour {
  27. public static DontDestroyScriptBetweenSceens instance;
  28. public static int points = 100;
  29.  
  30. void Awake() {
  31. if (!instance) {
  32. instance = this;
  33. DontDestroyOnLoad(transform.gameObject);
  34. } else {
  35. Destroy(gameObject);
  36. }
  37. }
  38.  
  39. void OnLevelWasLoaded(int level) {
  40. Text ui = GameObject.Find("/Canvas/Text").GetComponent<Text>();
  41. Debug.Log("scene was loaded");
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement