Hello!
I have 3 classes, A, B ,C
And I have a prefab. When I drop the prefab to the scene, and add an A component, A adds B to the game object, and B adds C.
When I delete A (click, remove component), B and C are removed too.
Because I’m adding this:
[ExecuteInEditMode()]
public class A : MonoBehaviour {
public void OnDestroy()
{
DestroyImmediate(B);
}
}
And, B destroys C the same way.
Now, What I want to do, is to have the same behaviour when I modify the prefab directly.
I have a Resources/ folder, with a prefab, I add an A component, B and C are added. But when I destroy A, B and C don’t, because Destroy() isn’t called.
How can I do this?
Thanks!