[SOLVED] Problem with using 'visibleThisFrame'

I used the forum topics to set it up, and it’s working when the entity is outside the screen but not when the entity is behind another entity.

image

    // Set visibility
    this.app.scene.layers.getLayerByName("World").onPostCull = (cameraIndex) => {
        if (this.target.model.meshInstances[0].visibleThisFrame) {
            this.entity.element.enabled = false;
        } 
        
        else {
            this.entity.element.enabled = true;
        }
    };