Ich lösche Feuerpartikel durch Rauchpartikel, also möchte ich überprüfen, ob das Objekt zerstört ist oder nicht, wenn Objekt zerstört wird, dann neue Szene laden. Hier ist mein Skript ,,,,,, Irgendwelche Vorschläge?überprüfen Objekt zerstört und laden neue Szene
using UnityEngine;
using System.Collections;
public class hey : MonoBehaviour {
void Start(){
GetComponent<ParticleSystem>().emissionRate = 0;
}
void Update(){
if (Input.GetMouseButtonDown (1)) {
GetComponent<ParticleSystem>().Emit (20);
}
}
void OnParticleCollision(GameObject obj)
{
Destroy (obj, 2.0f);
//here i want to check and then load new scene..
//I try that thing, but failed..nothing happen
if (object.Equals (obj, null)) {
Application.LoadLevel (7);
}
//also this one, but nothing happens
if(gameObject.tag=="fire123"==null){
Application.LoadLevel (7);
}
// also this one too, but failed :-(
void OnDestroy(){
Application.LoadLevel (7); } }
Haben Sie ohne Zeit in 'Destroy' versucht? Das könnte das Problem sein. Es ist noch nicht zerstört, wenn du zum if kommst. Versuchen Sie, es zu einer Coroutine zu machen (und mit 'waitForSeconds'). –
@GunnarB. Ja, ich denke nicht, ok, lass mich es versuchen. Danke für den Kommentar :-) –
@GunnarB. Vielen Dank, es funktioniert für mich .. bitte poste dies in Antwort Tab, ich werde es bewerten, um hilfreich zu sein. –