How to make objects only visible if you look through glass?

How can I make an object only visibile if you look through some

Franky, probably the easiest way is to use blueprint to hide/unhide the objects.

Also, I don’t know if you’ve seen this asset:

Use a scene capture to a texture and apply it as a material to your class. depending on your need you can add a trigger before the class to toggle the visibility of the cubes, like onEnter make them visible, onExit hide them again. In a SceneCapture you can also select which actors it should make visible in the texture which is quite powerfull