In the Learn game development w/ unity 2.2 ( Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn )
it says to make the code so the "gameObject"gets destroyed but once it is destroyed when i try to make a clone it says that the gameObject has been destroyed yet im still trying to access it, how do i solve this here problem?
Can you post an example of your code?
using System.Collections.Generic;
using UnityEngine;
public class DestroyOutOfBounds : MonoBehaviour
{
public float topBound = 30f;
// Start is called before the first frame update
void Update() {
if (transform.position.z > topBound)
{
Destroy(gameObject);} }
}```
We need to see the code of what is spawning these game objects. Ergo where the error is actually happening. Posting the full error stack trace will also show us exactly where the exception happens. Most likely though, something hasn’t been followed correctly in the tutorial. It might be worth going back and stepping through the steps again.
There is only 2 steps will dealing with null objects.
Step 1 Find out what is null
Step 2 Fix it