Öncelikle selamunaleyküm arkadaşlar. Ben normalde oyunlara mod falan yapıyordum. Şimdi ise kendim bir oyun yapmak istedim. Bu işlerde yeni olduğum için, yaptığım araştırmalarda en kolay yapılan oyunu Flappy Bird oyunu olarak gördüm. Kendim sıfırdan her şeyini ben yaparak yapılmaya koyuldum. Her şeyi hallettim. Ama spawn olan bir nesneyi ekrandan çıktıktan sonra silinmesi için ayarladım. Başlangıçta güzel güzel çalışıyor. Ama 4. objeden sonra hata veriyor ve objenin spawn olması da duruyor. Acaba ben bunu nasıl çözerim?
Kod:
HATA: MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object.Internal_InstantiateSingle (UnityEngine.Object data, UnityEngine.Vector3 pos, UnityEngine.Quaternion rot) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Object.Instantiate (UnityEngine.Object original, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) (at <127e81e1cb3441cc97d26b1910daae77>:0)
UnityEngine.Object.Instantiate[T] (T original, UnityEngine.Vector3 position, UnityEngine.Quaternion rotation) (at <127e81e1cb3441cc97d26b1910daae77>:0)
Spawner+<SpawnObject>d__5.MoveNext () (at Assets/Scripts/Spawner.cs:20)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <127e81e1cb3441cc97d26b1910daae77>:0)
[CODE title="Spawner.cs" highlight="22"]using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Spawner : MonoBehaviour
{
public Birdy bs;
public GameObject Borular;
public float height;
public float time;