So bear with me on this, Here is what i am trying to do, i have a picture to explain it better. So Let's say I have 3 Orange balls that are next each other, if a user clicks on one of them, i want my function to loop and find the next contact list, if the contact is orange in color, then loop until there is no more Orange contacts. You can assume, that I will check for color later, i know im not doing it because i enter an infinite loop if the body.GetUserData()!=null, so I am trying to fix it but I don't know how.

Code:
private List<Body> recursiveFind(Body body)
{
for (var c = body.GetContactList(); c != null; c = c.Next)
{
var body1 = c.Contact.GetFixtureA().GetBody();
var body2 = c.Contact.GetFixtureB().GetBody();
if(body1.GetUserData()!=null)
{
myList.Add(body1);
recursiveFind(body1);
}
if (body2.GetUserData() != null)
{
myList.Add(body2);
recursiveFind(body2);
}
}
return myList;
}
{
for (var c = body.GetContactList(); c != null; c = c.Next)
{
var body1 = c.Contact.GetFixtureA().GetBody();
var body2 = c.Contact.GetFixtureB().GetBody();
if(body1.GetUserData()!=null)
{
myList.Add(body1);
recursiveFind(body1);
}
if (body2.GetUserData() != null)
{
myList.Add(body2);
recursiveFind(body2);
}
}
return myList;
}
