MissingMethodExpection: Method not found: UpdateAnotherVar

MissingMethodExpection: Method not found: ‘testOutput.UpdateAnotherVar’
I get this error when I attach my test script. (This is for me to understand linking scripts).

testInput.js

var testVariable = 1;

var to : testOutput; // Assign it in the inspector



function Update()

{

    if( Input.GetKey("k") )

    {

        testVariable= 5;

        to.UpdateAnotherVar( testVariable );

    }

}

testOutput.js

var anotherVariable = 0;



function UpdateAnotherVariable( i : int ) 

{

    if( i == 5) // = is assignation, == is equality test

    {

       anotherVariable = 1;

    }

}

Can someone please correct this? I’ve asked my friends but they can’t help me.

You simply misspelled the function.

function UpdateAnotherVariable( i : int ) 
to.UpdateAnotherVar( testVariable );

See?