Why Scene does not open after scene fading? C#
My Scene does not open, but it goes to black screen (middle of the fading)? I tested this with out fading and it worked and went to the losing scene.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class loseParticle : MonoBehaviour {
public GameObject explosionPrefab;
void OnTriggerEnter2D(Collider2D obj) {
GameObject explosionObject = Instantiate(explosionPrefab, this.transform.position, Quaternion.identity) as GameObject;
Destroy (explosionObject, 5f);
Destroy (obj.gameObject);
StartCoroutine(ChangeLevel());
}
IEnumerator ChangeLevel () {
float fadeTime = GameObject.Find("_GM").GetComponent<Fading>().BeginFade(1);
yield return new WaitForSeconds(fadeTime);
SceneManager.LoadScene(2);
}
}
Comment
Answer by Aappo · Nov 08, 2016 at 03:44 PM
I have found a way it took long... So if someone has same broblem. You can ask me now :D It didn't load because i deleted the object that the script was attached to. thanks for your time all who helped or tried to help.