After the prefab it instantiated, it cannot change the value of the Game Controller Class. Why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MazeScript : MonoBehaviour
{
public GameController gameController;
public float moveSpeed = 5.0f;
public Transform destroyPoint;
// Update is called once per frame
void Update()
{
transform.Translate(Vector3.back * moveSpeed * Time.deltaTime);
if (transform.position.z <= destroyPoint.position.z)
{
Debug.Log("Can Destroy!");
this.gameController.canRemoveFromList = true;
Destroy(gameObject);
}
}
}