Searches for all actors of a specific type in this actor children list. Type of the actor to search for. Includes any actors derived from the type. All actors matching the specified type
()
| 289 | /// <typeparam name="T">Type of the actor to search for. Includes any actors derived from the type.</typeparam> |
| 290 | /// <returns>All actors matching the specified type</returns> |
| 291 | public T[] GetChildren<T>() where T : Actor |
| 292 | { |
| 293 | var count = ChildrenCount; |
| 294 | var length = 0; |
| 295 | for (int i = 0; i < count; i++) |
| 296 | { |
| 297 | if (GetChild(i) is T) |
| 298 | length++; |
| 299 | } |
| 300 | if (length == 0) |
| 301 | return Utils.GetEmptyArray<T>(); |
| 302 | var output = new T[length]; |
| 303 | length = 0; |
| 304 | for (int i = 0; i < count; i++) |
| 305 | { |
| 306 | if (GetChild(i) is T obj) |
| 307 | output[length++] = obj; |
| 308 | } |
| 309 | return output; |
| 310 | } |
| 311 | |
| 312 | /// <summary> |
| 313 | /// Searches for all scripts of a specific type from this actor. |
nothing calls this directly
no test coverage detected