Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Awake() {
- DontDestroyOnLoad(transform.gameObject);
- }
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class DontDestroyScriptBetweenSceens : MonoBehaviour {
- public static int points = 100;
- void Awake() {
- DontDestroyOnLoad(transform.gameObject);
- }
- void OnLevelWasLoaded(int level) {
- Text ui = GameObject.Find("/Canvas/Text").GetComponent<Text>();
- Debug.Log("scene was loaded");
- }
- }
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class DontDestroyScriptBetweenSceens : MonoBehaviour {
- public static DontDestroyScriptBetweenSceens instance;
- public static int points = 100;
- void Awake() {
- if (!instance) {
- instance = this;
- DontDestroyOnLoad(transform.gameObject);
- } else {
- Destroy(gameObject);
- }
- }
- void OnLevelWasLoaded(int level) {
- Text ui = GameObject.Find("/Canvas/Text").GetComponent<Text>();
- Debug.Log("scene was loaded");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement