Component dependency loop when copy/pasting components

It’s pretty simple to recreate this:

Create two scripts, ComponentA and ComponentB. Make A require B and B require A.

Adding A or B to an object works fine, but if you copy either of them and paste them (I did it ‘as new’) onto an empty gameobject, Unity will lock up because it is caught in a loop. It will add the copied ComponentA, then a ComponentB because it’s required, followed by another ComponentA because it’s required and so on to infinity, slowing Unity to an absolute crawl.

In hindsight, reciprocal requirements may have been a shoddy idea coding wise (in my case I was using a Player component and a PlayerInput component; the idea being you could disable input by simply disabling the input component) but it’s something that should probably get looked at. It’s one of those things that trips you up when you least expect it.

I’m running version 4.1.3 as Monodevelop stopped loading on the later versions for some mysterious reason; my apologies if this has already been fixed.

Heh, that’s a funny one. Please submit a mini repro project and link the case number here.