public Node[] GetChildrenWithComponent <T> (bool recursive = false) where T : Component { Runtime.ValidateRefCounted(this); var stringhash = Runtime.LookupStringHash(typeof(T)); int count; var ptr = NodeHelper.urho_node_get_components(handle, stringhash.Code, recursive ? 1 : 0, out count); if (ptr == IntPtr.Zero) { return(ZeroArray); } var res = new Node[count]; for (int i = 0; i < count; i++) { var node = Marshal.ReadIntPtr(ptr, i * IntPtr.Size); res [i] = Runtime.LookupObject <Node> (node); } if (Component.IsDefinedInManagedCode <T>()) { //is not really efficient, but underlying Urho3D knows nothing about components defined in C# return(res.Where(c => c.GetComponent <T>() != null).ToArray()); } return(res); }