void Start() { textObj = GetComponent <TextMeshProUGUI>(); _exploreManager = FindObjectOfType <ExploreManager>(); particles = FindObjectOfType <ParticleSystem>(); particleObj = particles.gameObject; particles.playOnAwake = false; _rect = GetComponent <RectTransform>(); w = Screen.width; h = Screen.height; screenSize = Camera.main.ScreenToWorldPoint(new Vector3(w, h, 0)); textChanged_Event.AddListener(ChangeText); // for particles to spawn in the correct position, we need to set the position of the text at the start newPos = Camera.main.ScreenToWorldPoint(new Vector2(_rect.position.x, _rect.position.y)); newPos = new Vector3(newPos.x, newPos.y, 90); textObj.SetText(_exploreManager.textNow); }
void OnDestroy() { ExploreManager.ReleaseOne(); }