[Solved] Making “Flappy Bird” Game In Unity3D (Flappy Plane), How To Destroy The Obstacles? [closed]


Is MonoBehaviour.Destroy(gameObject) what you’re after? I’m not really sure what part of the process you are struggling with?

Edit:
With the clarification, below is the revised answer:

Track the position of the players co-ordinates, and when an object finds that its own co-ordinates are less that players co-ordinate minus the offset of where the player is on the screen, destroy it. Basically something like the following (assuming the camera is always centred on the player and moves along with it):

void Update()
{
    int xBound = Camera.main.transform.position.x - (Screen.width / 2);
    if (transform.position.x < xBound)
    {
        MonoBehaviour.Destroy(gameObject)
    }
}

3

solved Making “Flappy Bird” Game In Unity3D (Flappy Plane), How To Destroy The Obstacles? [closed]