Hey all,
There are a number of ways in scripting to end up with an instance, without knowing much about it,
Such as runtime.objects.SomeFamily.getFirstInstance().children();
In this case, I am looking for all children that belong to a specific family.
for (const character in runtime.objects.characters.instances()) {
//how to easily get this:
const effects = character.children //where children belong to family "effects
//obviously that wont work, but I also dont see a way to to check...
//...if an instance belongs to a family.
//I can see a property "ObjectType" for checking instance types, but not family
//this is what I am doing instead:
for(const effect in character.children()) {
if (effect.instVars.aVariableExistingOnFamilyEffects !== undefined) {
//this specific variable exists only on the family "effects"
//since this child inst has that variable...
//...we can treat it as the family now.
}
}
}
Checking for a variable on the object that belongs to the family I want seems like a hacky way to go about going from a parent to checking for children of a specific family type.
I can't see that this is an uncommon operation, is there a better way of going about it?