Hello everyone, i was just wondering if someone might be able to point me in the right direction on how to accomplish this. i have 6 triangles in my game. it is a single scene game. They are all tagged with “TriangleP”. They also have Box Collider 2D. i created a script to randomize which triangle is assigned to a moving script (from itween). The objective is to click on the moving triangle. I have created 3 pop up UI’s, a 3 second countdown UI, a “Correct” Pop up UI for when you get it right, and lastly an “Incorrect” Pop up UI for when you got it wrong. My problem is that even during the 3 second countdown Pop up UI, i can still click in the background to beat the game, and the same goes for the Correct and Incorrect Pop up UI’s, even if i am already correct i can still click on a non moving object and get an incorrect despite the fact that the player has already beaten the game, is there any way to null the controls while the Pop ups are active.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class ClickObject : MonoBehaviour {
[SerializeField]
private GameObject NextLevelUI;
[SerializeField]
private GameObject TryAgainUI;
void Start (){
}
void Update (){
RaycastHit2D hit;
if(Input.GetMouseButtonDown(0)){
hit=Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition) , Vector2.zero);
if (hit.collider != null){
TryAgainUI.SetActive(true);
if(hit.collider.GetComponent<MoveSample>()!= null && hit.transform.gameObject.tag=="TriangleP"){
NextLevelUI.SetActive(true);
TryAgainUI.SetActive (false);{
Debug.Log("SUCCESS");
}
}
}
}
}
}
Any help would be greatly appreciated, i am new to coding so if i am way off don’t judge lol