Narf question on scope - I think :/

ok so I think i’m a bit narf on understanding this.

ive got a IEnumerator with a variable in it. I also have a function that i’m trying to run from the IEnumerator which has the variable in it.

my problem is that i’m getting this error:

error CS0103: The name `theVar’ does not exist in the current context

I know I probably should know the answer to this but I don’t. can someone explain it in english for me?

cheers

Do you mean you have something like the code below? That code will not compile because the variable name you pass to the function "notTheSameVarName" is different than the variable name you use in the enumerator "theVar". How is MyOtherMethod supposed to know what theVar is?

    IEnumerator MyMethod()
	{
		var theVar = new int ();
		MyOtherMethod (theVar);
		yield return WaitForSeconds (5);
	}

	void MyOtherMethod(int notTheSameVarName)
	{
		theVar += 1;
	}

I could be totally off here depending on what your code is, so posting your enumerator and method code would probably help if that isn’t the case :).