void AddLink(OctreeObject <T> obj) { if (firstObject == null) {//Adding the first object firstObject = obj; obj.previous = null; obj.next = null; } else { //Insert at beginning obj.previous = null; obj.next = firstObject; firstObject.previous = obj; firstObject = obj; } obj.SetNode(this); if ((localItemCount += 1) == 1 && childIndex != -1) //Let our parent know we now have objects { parent.ChildHasObjects(childIndex, true); } }