getObjectByProperty method

Object3D? getObjectByProperty(
  1. String name,
  2. String value
)

name -- the property name to search for.

value -- value of the given property.

Searches through an object and its children, starting with the object itself, and returns the first with a property that matches the value given.

Implementation

Object3D? getObjectByProperty(String name, String value) {
  if (getProperty(name) == value) return this;

  for (int i = 0, l = children.length; i < l; i++) {
    final child = children[i];
    final object = child.getObjectByProperty(name, value);
    if (object != null) {
      return object;
    }
  }

  return null;
}