Add an event listener when GameObject becomes a child of another

I’d like to have a listener on my gameobject for when it becomes a child of another gameobject, so I can perform functions based on what it’s added to.

Any good of way of doing it, or is this a silly thing to do anyway?

bool isEvenFired=false;
public delegate void IsChild(bool status);
public event IsChild ChildEvent;

void Update(){
if(!isEventFired){
isEventFired=true;
if(ChildEvent!=null){
ChildEvent(transform.parent!=null);
}
}
}

And in other scripts you just need to assign a method to this delegate and event will be fired… Hope this will give you a quick idea about it.