class MyComponentA : MonoBehaviour {}
class MyComponentB : MonoBehaviour
{
void Reset()
{
var componentA = this.GetComponentInParent<MyComponentA>();
Debug.Log(componentA == null); // componentA will be null if you add MyComponentB to object via Project View inspector.
}
}
When you add MyComponentA and MyComponentB sequentially, it shows false if you are in Prefab Scene mode. But it shows true if you are inspecting via Project View.