Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

compile error in GVRVideoPlayerTexture.CallPluginAtEndOfFrames() #406

Closed
alanlee-gn opened this issue Dec 16, 2016 · 8 comments
Closed

compile error in GVRVideoPlayerTexture.CallPluginAtEndOfFrames() #406

alanlee-gn opened this issue Dec 16, 2016 · 8 comments

Comments

@alanlee-gn
Copy link

alanlee-gn commented Dec 16, 2016

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
    }
  
    //...
  }
@nathanmartz
Copy link

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

@inventsimple
Copy link

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

@alanlee-gn
Copy link
Author

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.

@GianmarcoLozano
Copy link

How?

@alanlee-gn
Copy link
Author

@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.

@MadJlzz
Copy link

MadJlzz commented Jan 23, 2017

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)

@GianmarcoLozano
Copy link

GianmarcoLozano commented Jan 23, 2017 via email

@piyushvadsak
Copy link

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);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants