Question by
VShadow · Oct 26, 2019 at 06:04 PM ·
2d collision
2D Collision Problem
Hey guys, so I am pretty new to Unity (but I have used java script before) and I've been getting this error lately "OnCollisionEnter2D This message parameter has to be of type: Collision2D".
This is my code:
private void OnCollisionEnter2D(Collision2D col){
if (col.transform.CompareTag("Player"))
{
col.transform.position = nextportal.position;
}
if (col.transform.CompareTag("Inter"))
{
col.transform.position = nextportal.position;
}
}
Thx in advance!
Comment
Are you SURE the error is co$$anonymous$$g from this script? The function seems fine. What is the exact stacktrace in the console? What is the name of the script you have provided?