getChildByName method

Node? getChildByName(
  1. String name, {
  2. bool excludeAnimationPlayers = false,
})

Implementation

Node? getChildByName(String name, {bool excludeAnimationPlayers = false}) {
  for (var child in children) {
    if (excludeAnimationPlayers && child._animationPlayer != null) {
      continue;
    }
    if (child.name == name) {
      return child;
    }
    var result = child.getChildByName(name);
    if (result != null) {
      return result;
    }
  }
  return null;
}