Make objects invisable when they are passing through

Hi! I’m working on an open world continuation of my previous game Roundabout, you should look at the trailer to get a better idea of what i’ll be talking about: https://play.google.com/store/apps/details?id=com.DaneGillis.RoundaboutFree

All enemies are made out of the same “special” material like the walls which in the game would allow them to pass through them, fuse with them but then “re-emerge” and continue moving or another use would be to have them enter the wall, becoming invisable transitionally and then destroy them when they have “dissapeared” completely, making it seem like they merged with the wall.

To achieve this effect i’d need something like a mask but the other way around, instead of hiding objects that aren’t in a certain area, i’d need to hide objects or parts of it when they enter an area and have them become visable again while leaving.

The problem is that i don’t know where to begin making something like this and it’s a pretty specific thing so i can’t find it on google, i’m hoping to get some tips on how to hide the objects in this way.

Thanks in advance.

You can do this by disabling the Mesh Renderer when you are inside a wall (OnTriggerEnter) , and then re-enabling it when you are outside the wall (OnTriggerExit I believe)

You can try fadeout/ fadein transition by playing with that objects materials alpha value in color attribute by selecting appropriate shader(which will support transparency). If u want particular part of that object should be visible/invisible, I am sure you can achieve it through shaders alpha value/transperience attribute. As well as u can witre your woun shader to do translation . I hope this will guide you to what you are looking for.