在Unity中构建至Android时出错

时间:2018-07-04 10:58:03

标签: c# android unity3d

我在首选项中设置了我的SDK和JDK,每次尝试运行它时都会遇到以下错误。真的不确定是什么问题。我也在手机上启用了调试功能。

  

资产/ Vuforia /脚本/实用程序/VRIntegrationHelper.cs(99,29):错误CS1061:类型UnityEngine.Camera' does not contain a definition for SetStereoProjectionMatrices',找不到扩展方法SetStereoProjectionMatrices' of type UnityEngine.Camera'。您是否缺少装配参考?

由于脚本存在编译器错误而导致构建Player出错

构建完成,结果为“失败”

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:182 
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00065] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:89 
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

1 个答案:

答案 0 :(得分:2)

您需要更改代码:

mLeftCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix,mRightCamera.projectionMatrix); mRightCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix,mRightCamera.projectionMatrix);

关于这一点:

mLeftCamera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Left,mRightCamera.projectionMatrix); mRightCamera.SetStereoProjectionMatrix(Camera.StereoscopicEye.Right,mRightCamera.projectionMatrix);