fix bug

Unity was getting frozen. It seems the problem was that it enters an
infinite loop searching for new resources when the original was
still there. However, the problem might be caused by the pathfinder.