For this challenge insted of creating methods and stuff I’ve found the easiest working solution:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Level : MonoBehaviour
{
[SerializeField] Text blockCountObj;
int blockCount;
// Start is called before the first frame update
void Start()
{
}
void BlockCountFunction ()
{
blockCountObj.text = blockCount.ToString();
}
// Update is called once per frame
void Update()
{
blockCount = GameObject.FindGameObjectsWithTag("Block").Length;
Debug.Log(blockCount);
BlockCountFunction();
NexLevel();
}
void NexLevel()
{
if (blockCount == 0)
{
SceneManager.LoadScene(0);
}
}
}
Is this a legal solution or not? It works as intended, blocks are being counted, the number is correctly updated.
@ben @Rick_Davidson I summon you guys