I’m editing a script that was made for Unity 3D, and need to make it work for 2D. I’ve got it all pretty good besides an overloaded method error. Here’s the part thats giving me trouble…
if (Physics2D.Raycast(Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.5f)), out hit, 5f))
{
if (hit.collider != null)
{
if (hit.collider.GetComponent<UI_Item>() != null)
{
go = hit.collider.gameObject;
displayMessage = true;
}
else
{
displayMessage = false;
go = null;
}
}
else
{
displayMessage = false;
go = null;
}
}
I’m pretty new to C#, and coding in general, so any help is awesome! Thanks :).