How to make unity2d check answer button

Hello, i want to make a kids math puzzle game for my FYP. My idea, there were a question (image) and the answer box is an empty box which user will drag the correct answer(image) from the inventory to the box. Each level have 3 question and 1 star per question if correctly answer (like angry bird). Then, user will click on the check button. At this point, the game will check whether the answer (image) is assign correctly to the box. So my problem is, i don’t know how to make the the check answer script and how to make the star as the marks for each level. Can anyone help me?

Hi! Well first of all you can do all this with Unity’s UI system. Create a canvas where you will have several Game Objects (QuestionOne, QuestionTwo, Number7, Number6,BoxQuestion1, BoxQuestion2 etc) .

Regarding each question can just be plain text, therefore select the GO that will refer to a question and create a new text component.

Afterwards, make the BoxQuestion2, BoxQuestion1 game objects be childs of their respective questions and place them next to them like it is in the drawing. For each Box, add a box collider that matches it size and mark its Trigger property as true. Also add a script componente with a script like this

using UnityEngine;
using System.Collections;

public class TestBox2 : MonoBehaviour {

	public bool filled;
	// Use this for initialization
	void Start () 
	{
		filled = false;
	}
	
	// Update is called once per frame
	void Update () 
	{
			
	}

	void OnTriggerEnter2D(Collider2D c)
	{	
	
			if (c.tag== "six") 
		{
			Debug.Log ("Question 2 is good");
			filled = true;
		}
		else{
			Debug.Log ("Question 2 is bad");
			filled = true;
		}
	

	}
}

Later, for the answer inventory, each game object that’s there (Numer7, Number6) , will have its own tag “six” or “seven” according to what number they are. Also, each game object will have its box collider as well, and also the Trigger property marked.

What you can do is that if the BoxCollider from the AnswerBox collides with the correct number (I.e the tag"six") it is valid and the property filled will be true.

Why do you want it to check if its filled? Well, when you hit the check button you can verified if all answer boxes are “filled” to see the answer.