insertTo method

void insertTo(
  1. int? obj
)

Implementation

void insertTo(int? obj) {
  if (parent != 0) {
    removeFromTree();
  }

  var p = GameObject(obj);

  if (p.child > 0) {
    //parent already has child, make that child our sibling now
    sibling = p.child;
  }

  p.child = id;
  parent = obj;
}