Hello guys. I pretty much have many canvas in my scene. What I want is when a canvas is enabled to add 1 point. Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class test2 : MonoBehaviour
{
public Text scoreText;
public int point;
private bool shouldScore = true;
void OnEnable ()
{
if (this.shouldScore && gameObject.activeSelf)
{
point++;
scoreText.text = point + "";
shouldScore = false;
}
}
}
So it works only for the 1st canvas. One guy told me to modify shouldScore = false;
but i can not figure it out… any thoughts?