Answer the question
In order to leave comments, you need to log in
How to solve error CS1520?
The code:
private OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Ground")
isGrounded = true;
}
private OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.tag == "Ground")
isGrounded = false;
}
Answer the question
In order to leave comments, you need to log in
void should have been added
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Ground")
isGrounded = true;
}
private void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.tag == "Ground")
isGrounded = false;
}
you only return the value if the condition is met, add else or return by default.
and read the documentation there everything is written
https://docs.microsoft.com/ru-ru/dotnet/csharp/mis...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question