Unchilding camera when contact with enemy

Hi, i have a little problem finding out how you can unchild the camera from the player when he collides with an object. Anyone can tell me how you unchild objects?

Like this, I would guess:

transform.parent = null;

(Would have to try it or check the docs to be sure though…)