We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fbc560 commit 08e3cb0Copy full SHA for 08e3cb0
src/com/javagamemaker/javagameengine/components/Component.java
@@ -462,6 +462,15 @@ public LinkedList<Component> getAllChildren(Component type){
462
return children;
463
}
464
465
+ public <T>T getChild(){
466
+ for (Component child : this.children){
467
+ try{
468
+ return ((T)child);
469
+ }
470
+ catch (Exception e){}
471
472
+ return null;
473
474
/**
475
* @param type the specified type of the children to be returned
476
* @return if type is (new PhysicsBody()) it will return the first child that is a physicsBody as Component
0 commit comments