Hi!
That’s strange but my level gameobject doesn’t have a serialised field for breakable blocks but I did serialize this integer in my script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Level : MonoBehaviour
{
// parameters
[SerializeField] int breakableBlocks; // Serialized for debugging purposes
// cached reference
SceneLoader sceneloader;
private void Start()
{
sceneloader = FindObjectOfType<SceneLoader>();
}
public void CountBreakableBlocks()
{
breakableBlocks++;
}
public void BlockDestroyed()
{
breakableBlocks--;
if (breakableBlocks <= 0)
{
sceneloader.LoadNextScene();
}
}
}