How to get count number of children?

I thought I could use the following but ‘number_of_layers’ returns undefined. Whats wrong?

var instance = modelAsset.resource.instantiate();
number_of_layers=instance.children.length;

Thanks :slight_smile:

Works fine for me in a test project.

Have you defined the variable number_of_layers? Or should it be:

var number_of_layers = instance.children.length;