When using Visual Studio Professional 2015 with Unity, I've noticed that when I am stepping though the body of a lambda expression, I cannot watch variables which were declared/assigned outside of but are being read inside of the lambda expression.
private IEnumerator DoTheThing(string filter)
{
TextureDownload texDl = new TextureDownload();
texDl.OnCompleted += () =>
{
_log.Log("Mesh texture " + texDl.GetType() + ":" + texDl.GetHashCode());
textures.Add(texDl);
};
yield break;
}
I get the error
The identifier
texDlis not in the scope
Obviously the variable is accessible in this scope, because the lambda function is using it.
Is there any remotely easy/convenient way to watch the value of such variables?