calling CombineChildren.cs function from Instantiate.js script isn't working

I want to call a function in CombineChildren.cs called CallCombineOnAllChilds()from another script when 1000 objects have been instantiated, the Instantiation and CombineChildren.cs scripts are both on the parent object.

I link the script with this global variable :

var cbn : CombineChildren;

and after the instantiate loop i++

I do this code :

if ( i ==  1000);{
//gameObject.GetComponent(CombineChildren);//

cbn.CallCombineOnAllChilds();

}

and it says I have a code error.

I also tried various other syntaxes-what can I do?

access cs from js shows some interesting things:

Script_compilation Basically, if you don’t have a .cs in your plugins folder you’re going to have a hard time accessing it from a .js file.

How do you access a cs file class from javascript

From Cross Script Communication:

Although frankly you’re better off sticking to one language in most cases.

–Eric

All that from one google search. :slight_smile:

ok it works, i needed to use the script specific to the root object and to use the combine instead of combineallchilds: and not write if (i==65000);{

var other : CombineChildren;
other = gameObject.GetComponent(CombineChildren);


................
update -
if ( Input.GetKeyDown("y") ){
//gameObject.GetComponent(CombineChildren);
other.Combine();

}