Another solution to prevent Double Play using nested if statements

Well done for finding your own solution to this problem @Ndunaka_Laurien.

This is a strong indication that you grasped the concept you gained from the course & are able to apply it independently

Just a quick note, you can even sum this if statement into one line like this:

if (stop && collision.CompareTag("Ground")
{
    // Rest of your code
}

Here I used collision.CompareTag("Ground") instead of collision.tag == "Ground" for performance sake, but for now at this stage there’s no need for you to worry about performance but use the one you feel most comfortable with

Wish you more great experiences in the future

1 Like

Privacy & Terms