- Home /
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.
Thanks that you are trying to help me, but I do not understand it yet :(
Change this line:
to.UpdateAnotherVar( testVariable );
To this:
to.UpdateAnotherVariable( testVariable );
On another note, I think your coding style has way too many spaces.
Thanks, thanks thank you!
I'm so stupid I didn't saw that :|.
Answer by fafase · Jun 18, 2012 at 03:11 PM
You simply misspelled the function.
function UpdateAnotherVariable( i : int )
to.UpdateAnotherVar( testVariable );
See?
@geennaam Auto completion is your best friend. Ctrl + space.
I came to this question and the first thing I looked at was the function names. I think the error message spells it out well enough.