How do i detect for no collision before update

In this script i have created i want the the gameobject to detect if a player or enemy collides with it, then if it does don’t create the block, but destroy itself, but the update gets called before the collision how can i change the script so it works how i want it to?

public bool OCollision = false;

    public GameObject Block_object;

void OnTriggerEnter(Collider other){
        if (other.gameObject.tag == "Player" || other.gameObject.tag == "Enemy" || other.gameObject.tag == "Block") {
            OCollision = true;
        }
    }
    void Update(){
        if (OCollision == false) {
            Destroy (this.gameObject);
            Debug.Log (OCollision);
            Instantiate (Block_object, transform.position, transform.rotation);
        } else if (OCollision == true) {
            Destroy (this.gameObject);
        }

    }

You could try adding another boolean variable into the OnTriggerEnter function that is set to true whenever a collider enters it. Then, add one more condition to your code in the Update() function that checks to see if that variable is true or not – then run your other conditions within that.

Maybe something like this:

public bool OCollision = false;

    public GameObject Block_object;
    public bool didSomethingCollide = false;

void OnTriggerEnter(Collider other){
     
        didSomethingCollide = true;

        if (other.gameObject.tag == "Player" || other.gameObject.tag == "Enemy" || other.gameObject.tag == "Block") {
            OCollision = true;
        }
    }
    void Update(){
        if(didSomethingCollide == true) {
             if (OCollision == false) {
                 Destroy (this.gameObject);
                 Debug.Log (OCollision);
                 Instantiate (Block_object, transform.position, transform.rotation);
             } else if (OCollision == true) {
                 Destroy (this.gameObject);
             }

             didSomethingCollide = false;
        }

    }

What i want it to do is if it has not collided with anything(which there is no method for):

Does anyone know to solution to solving my problem of testing for no collision before an update?

There is no direct way to do this. If you are using a primitive then you can use a sphere cast or a sweep. If you have a more complex collider then the best I’ve seen is to simply wait until after the next FixedUpdate and check if OnTriggerEnter fired.