Relative Content

Tag Archive for c#unity-game-enginerecursiontreeinfinite-loop

How do I prevent circular dependencies in a general tree?

I have a class in c# called Pose. Its functionality is not really important, but it contains as fields another Pose called _parent, and a List called _children. In the setter for the _parent, I need to make sure that setting the parent doesn’t cause a circular dependency, as that would end up causing infinite recursive loops in other methods.