Error With Video Capture Script

Hello,

I upgraded a project from Unity 5.6.2 to 5.6.4 and now it no longer builds. I was using Unity - Scripting API: VideoCapture as a reference to do video capture in my project. However when I try to build I get the error:

InvalidOperationException: Operation is not valid due to the current state of the object
System.Linq.Enumerable.First[Resolution] (IEnumerable`1 source)

From the line:

Resolution cameraResolution = VideoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();

Which is directly from the Unity documentation. Can I get some help with what is going wrong here?

That sounds really odd that is the line you are getting the error. Can you try deleting your library folder to see if that fixes your issue?

I tried deleting the library folder but I am still getting the same issue. Looking at it again I am getting a number of other errors as well so perhaps I am doing something else wrong.

Ex. Assets\HoloToolkit-Examples\SharingWithUNET\Scripts\GenericNetworkTransmitter.cs(114,57): error CS0246: The type or namespace name ‘StreamSocketListener’ could not be found (are you missing a using directive or an assembly reference?)

There are a number of these errors of this format.

Edit: This might be an issue with my installation. I am going to try to reinstall and see if that fixes things.

Okay reinstalling did not help. I don’t know what is going wrong here.

Do you run into any of these issues with a fresh project, or does this repro just from using HoloToolkit?

I just tried setting up a new project and I run into a different error when I attempt to build.

FileNotFoundException: Could not find rc.exe in the Windows SDK directory!
PostProcessUAP.GetResourceCompilerPath () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessUAP.cs:157)
PostProcessWinRT.CreateWindowsResourceFile (System.String targetDirectory) (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:787)
PostProcessWinRT.CreateWindowsResourceFile () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:798)
PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:208)
UnityEditor.WSA.BuildPostprocessor.DoPostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:155)
UnityEditor.WSA.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:162)
UnityEditor.HostView:OnGUI()

Which windows SDK are you using? Do you have rc.exe in “C:\Program Files (x86)\Windows Kits\10\bin\x64” or “C:\Program Files (x86)\Windows Kits\10\bin<SDK_VERSION>\x64” folders?

I am not sure about SDK version but I am using Windows 10 Version 1607 OS Build 14393.1480.

I do not see a bin folder in that directory. Screenshot: Imgur: The magic of the Internet

I think my build environment was changed and now I’m missing some necessary files for HoloLens development which might be the problem. I am going to reinstall the tools and see if that fixes everything.

Yeah looks like you’re missing a Windows SDK. You can download it here: Windows SDK - Windows app development | Microsoft Developer

Reinstalled VS with UWP enabled and that seemed to fix my issues. Thanks for the help.