- Home /
Check if two different objects are pairing
Hey guys, I am creating a pair match game with math operations, so people need to match with their summary. So I created a box with textmeshpro inside of it, and created random random numbers, and on another box, it has the summary. So I want to create a check for the boxes that when they trigger, they will have to match if the answer is true. How would you approach that? How would you check if the two boxes are match together? I would do check sprite in simple drag n drop match. But in here, I dont know what should i check as object so that they can trigger with each other
public class QuizManager : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI number1Text;
[SerializeField] private TextMeshProUGUI number2Text;
[SerializeField] private int number1;
[SerializeField] private int number2;
[SerializeField] private int summary;
[SerializeField] TextMeshProUGUI summaryText;
private void Start()
{
summary = number1 + number2;
number1Text.text = number1.ToString();
number2Text.text = number2.ToString();
summaryText.text = summary.ToString();
if (number1 + number2 == summary)
{
// CAN ASSEMBLE & MATCH
Debug.Log("Answer is correct");
}
}
}
Your answer
Follow this Question
Related Questions
Mecanim Target Matching isn't working!! 0 Answers
Match 3 objects and destroy!?!?! 0 Answers
Offline match in a multiplayer game 2 Answers
How to make Match card game in unity? 1 Answer
Filling the board in a match 3 game,Match 3, generating code 0 Answers