Detect GameObject Position

I wanted to check the transform x position of My GameObject titled “Flappy” and run A debug if it was less than -12f this is what I had setup. it wont work, but it has no errors

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnManager : MonoBehaviour
public GameObject Flappy;
public float DeathPosition = -12f;

 void Update()
        if(Flappy.transform.position.x < DeathPosition)

This must work. Position is wrong or you dont see console logs (that is not an error log may be closed)

Is it local position or world position? You have to figure it out first in my experience.

You forgot to define the variable Flappy. Make a void Start() function and enter "Flappy = GameObject.Find(“Flappy”);

I guess if Flappy gameobject is null, then error will be occurred, but he didn’t mention about it.
This means that he assigned Flappy gameobject in Hierarchy.
So you don’t have to consider that point. This is just my opinion, so it could be wrong, sometimes…

Somehow I just opened up unity and It was working? I dont know why. I saved my code before Going onto Unity to test and it didnt work. I dont know what happened but thank you guys for trying to help