Gvr-unity-sdk: compile error in GVRVideoPlayerTexture.CallPluginAtEndOfFrames()

Created on 16 Dec 2016  ·  8Comments  ·  Source: googlevr/gvr-unity-sdk

When compiling with MonoDevelop, following error occurs during compilation;

Assets/GoogleVR/Scripts/Video/GVRVideoPlayerTexture.cs(595,7): error CS1622: Cannot return a value from iterators. Use the yield return statement to return a value, or yield break to end the iteration.

The problem code is below.

  private IEnumerator CallPluginAtEndOfFrames() {
    if (processingRunning) {
      Debug.LogError("CallPluginAtEndOfFrames invoked while already running.");
      Debug.LogError(StackTraceUtility.ExtractStackTrace());
      return false;  //<-------- compile error
    }

    //...
  }

Most helpful comment

With all do respect, I'm surprised Google didn't do a hotfix to correct this issue. Is this something that is being done?

All 8 comments

Our apologies but this is a bug in 1.10.0. That line should read "yield break;" Change that and you'll be g2g.

With all do respect, I'm surprised Google didn't do a hotfix to correct this issue. Is this something that is being done?

I think Google should have at least have documented the problem in the Release Notes if they knew about it. Not sure why the difference but you don't run into this problem if you just build and run from Unity. It's only a problem when you compile the project from MonoDevelop. You can edit the source code yourself if needed as I've done.

How?

@GianmarcoLozano This is where the source code is located if you add the GoogleVR package to your project --> Assets/GoogleVR/Scripts/Video/GVRVideoPlayerTexture.cs:595
Just change 'return false;' to 'yield break;' with any text editor.

Not sure why the difference but you don't run into this problem if you just build and run from Unity.

@alanlee-gn

Well, I encounter the error during last week GGJ and it won't run in Unity either because it is a real compilation error.

Therefore by changing return false; by yield break;, it resolves the above-mentioned problem. (at least for the compilation, I do not know if this class was used during runtime)

Ok thank you

El lun., 23 ene. 2017 8:20, Julien KLAER notifications@github.com
escribió:

Not sure why the difference but you don't run into this problem if you
just build and run from Unity.

Well, I encounter the error during last week GGJ and it won't run in Unity
either because it is a real compilation error.

Therefore by changing return false; by yield break;, it resolves the
above-mentioned problem.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/googlevr/gvr-unity-sdk/issues/406#issuecomment-274485985,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AScI4miqZpZE7vf7pknUQf4-SXkIyGm9ks5rVKkWgaJpZM4LO9mz
.

I solve this error.....
A single method cannot both yield return and return. You must choose one or the other.

You can either do a foreach to yield return the list:

else
{
foreach (var item in CalculateDeltas(sequence))
yield return item;
}
Or separate your code into two methods:

if (absolute)
return CalculateAbsoluteDeltas(sequence);
else
return CalculateDeltas(sequence);

Was this page helpful?
0 / 5 - 0 ratings