Sorry, I just downloaded Unity and started to learn C# code one week ago LoL
How can I write a code in C# that makes a task when I click on an object that have a certain name and makes another task when I click on an object with another given name?
I tried with this:
public void OnMouseOver()
{
if (Input.GetMouseButtonDown(0))
{
if (gameObject.name == “Yellow block”)
{
//do task 1;
}
if (gameObject.name == "Red block")
{
//do task 2;
}
}
}
,