c#-急!unity导入vuforia包后出现CS1061错误,求大神帮忙看看!

问题描述

急!unity导入vuforia包后出现CS1061错误,求大神帮忙看看!

Assets/Vuforia/Scripts/Utilities/VRIntegrationHelper.cs(94,43): error CS1061: Type object' does not contain a definition forApplyCorrectedProjectionMatrix' and no extension method ApplyCorrectedProjectionMatrix' of typeobject' could be found (are you missing a using directive or an assembly reference?)

解决方案

贴出你的代码,很可能是你忘记调用方法加上括号了,方法名写错了,或者你的类型用错了。

解决方案二:

using System;
using UnityEngine;

using Vuforia;

public class VRIntegrationHelper : MonoBehaviour
{
private static Matrix4x4 mLeftCameraMatrixOriginal;
private static Matrix4x4 mRightCameraMatrixOriginal;

private static Camera mLeftCamera;
private static Camera mRightCamera;

private static HideExcessAreaAbstractBehaviour mLeftExcessAreaBehaviour;
private static HideExcessAreaAbstractBehaviour mRightExcessAreaBehaviour;

private static Rect mLeftCameraPixelRect;
private static Rect mRightCameraPixelRect;

private static bool mLeftCameraDataAcquired = false;
private static bool mRightCameraDataAcquired = false;

public bool IsLeft;
public Transform TrackableParent;

void Awake()
{
    GetComponent<Camera>().fieldOfView = 90f;
}

void Start()
{
    VuforiaBehaviour.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);//报错
}

void OnVuforiaStarted()
{
    mLeftCamera = DigitalEyewearBehaviour.Instance.PrimaryCamera;
    mRightCamera = DigitalEyewearBehaviour.Instance.SecondaryCamera;

    mLeftExcessAreaBehaviour = mLeftCamera.GetComponent<HideExcessAreaAbstractBehaviour>();
    mRightExcessAreaBehaviour = mRightCamera.GetComponent<HideExcessAreaAbstractBehaviour>();
}

void LateUpdate()
{
    // to this only once per frame, not for both cameras
    if (IsLeft)
    {
        if (mLeftCameraDataAcquired && mRightCameraDataAcquired)
        {
            // make sure the central anchor point is set to the latest head tracking pose:
            DigitalEyewearBehaviour.Instance.CentralAnchorPoint.localRotation = mLeftCamera.transform.localRotation;
            DigitalEyewearBehaviour.Instance.CentralAnchorPoint.localPosition = mLeftCamera.transform.localPosition;

            // temporarily set the primary and secondary cameras to their offset position and set the pixelrect they will have for rendering
            Vector3 localPosLeftCam = mLeftCamera.transform.localPosition;
            Rect leftCamPixelRect = mLeftCamera.pixelRect;
            Vector3 leftCamOffset = mLeftCamera.transform.right.normalized * mLeftCamera.stereoSeparation * -0.5f;
            mLeftCamera.transform.position = mLeftCamera.transform.position + leftCamOffset;
            mLeftCamera.pixelRect = mLeftCameraPixelRect;

            Vector3 localPosRightCam = mRightCamera.transform.localPosition;
            Rect rightCamPixelRect = mRightCamera.pixelRect;
            Vector3 rightCamOffset = mRightCamera.transform.right.normalized * mRightCamera.stereoSeparation * 0.5f;
            mRightCamera.transform.position = mRightCamera.transform.position + rightCamOffset;
            mRightCamera.pixelRect = mRightCameraPixelRect;

            BackgroundPlaneBehaviour bgPlane = mLeftCamera.GetComponentInChildren<BackgroundPlaneBehaviour>();
            bgPlane.BackgroundOffset = mLeftCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;

            mLeftExcessAreaBehaviour.PlaneOffset = mLeftCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;
            mRightExcessAreaBehaviour.PlaneOffset = mRightCamera.transform.position - DigitalEyewearBehaviour.Instance.CentralAnchorPoint.position;

            if (TrackableParent != null)
                TrackableParent.localPosition = Vector3.zero;

            // update Vuforia explicitly
            VuforiaBehaviour.Instance.UpdateState(false, true);//报错

            if (TrackableParent != null)
                TrackableParent.position += bgPlane.BackgroundOffset;

            // set the projection matrices for skewing
            VuforiaBehaviour.Instance.ApplyCorrectedProjectionMatrix(mLeftCameraMatrixOriginal, true);//报错
            VuforiaBehaviour.Instance.ApplyCorrectedProjectionMatrix(mRightCameraMatrixOriginal, false);//报错

#if !(UNITY_5_2 || UNITY_5_1 || UNITY_5_0) // UNITY_5_3 and above

            // read back the projection matrices set by Vuforia and set them to the stereo cameras
            // not sure if the matrices would automatically propagate between the left and right, so setting it explicitly twice
            mLeftCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix, mRightCamera.projectionMatrix);
            mRightCamera.SetStereoProjectionMatrices(mLeftCamera.projectionMatrix, mRightCamera.projectionMatrix);

#endif
// reset the left camera
mLeftCamera.transform.localPosition = localPosLeftCam;
mLeftCamera.pixelRect = leftCamPixelRect;

            // reset the position of the right camera
            mRightCamera.transform.localPosition = localPosRightCam;
            mRightCamera.pixelRect = rightCamPixelRect;
        }
    }
}

// OnPreRender is called once per camera each frame
void OnPreRender()
{
    // on pre render is where projection matrix and pixel rect are set up correctly (for each camera individually)
    // so we use this to acquire this data.
    if (IsLeft && !mLeftCameraDataAcquired)
    {
        mLeftCameraMatrixOriginal = mLeftCamera.projectionMatrix;
        mLeftCameraPixelRect = mLeftCamera.pixelRect;
        mLeftCameraDataAcquired = true;
    }
    else if (!mRightCameraDataAcquired)
    {
        mRightCameraMatrixOriginal = mRightCamera.projectionMatrix;
        mRightCameraPixelRect = mRightCamera.pixelRect;
        mRightCameraDataAcquired = true;

    }
}

}
//inatance后面老报错,我没有添加实例么??还是没有传递什么参数??报CS1061的错误。。。。。

解决方案三:

是你的插件包所需的unity版本,跟你现有的导入插件的unity版本不匹配吧。

时间: 2024-08-20 00:27:34

c#-急!unity导入vuforia包后出现CS1061错误,求大神帮忙看看!的相关文章

微信公众平台-微信开发,编辑模式下创建的自定义菜单,微信会推送数据包给开发者么?求大神解答,急

问题描述 微信开发,编辑模式下创建的自定义菜单,微信会推送数据包给开发者么?求大神解答,急 微信开发,编辑模式下创建的自定义菜单,微信会推送数据包给开发者么?求大神解答,急 解决方案 编辑模式?开发模式吧..开发模式下发布的新信息也会推送给客户 解决方案二: 编辑模式?开发模式吧..开发模式下发布的新信息也会推送给客户

unity3D 求大神帮忙指点!!!!!!急急急

问题描述 unity3D 求大神帮忙指点!!!!!!急急急 unity场景里有三个cube 在plan上 选中其中一个后:在plan上点哪里选中的cube 就去那里!! 我不会的地方就是 这个选中的部分 !!!和选中后如何连接寻路那个script的地方!!麻烦大神指点!!!!! 解决方案 先用射线找到点到的那个物体 具体代码 RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physi

求大神帮忙解决 Android项目java空指针异常问题 真的很急 - -

问题描述 求大神帮忙解决 Android项目java空指针异常问题 真的很急 - - 新手小白参考网上教程学习的socket使用,代码几乎雷同老师写的就可以运行我的就会出问题,connect()方法正确可用,但是send()方法不能用,会提示如图空指针异常,但是我真的找不到是哪里的问题,求大神指点.困扰两天了 茶不思饭不想.(由于提问字数问题导包部分代码没有粘过来) 我用Broadcast在一个activity中监听到操作后广播消息过来然后触发java类里面的方法,触发到connect()就可以

实时调试- 电脑一开机就跳出对话框显示.NET FRAMWORK出现错误, 急求大神帮忙解决!

问题描述 电脑一开机就跳出对话框显示.NET FRAMWORK出现错误, 急求大神帮忙解决! 电脑原本没这个问题,昨天卸载了一些如土豆视频之类的应用软件后就出现了此问题,现在QQ,迅雷等账号都无法登陆,显示登陆超时,但浏览器网页可以打开.我试过将.NET FRAMWORK卸载后重装,问题依然无法解决.错误对话框如下: 解决方案 既然是启动出问题,装个CClear之类的工具,把启动项分批禁用,找出引起问题的那个,删除它. 解决方案二: Microsoft.NET没有安装好或者与是系统Microso

java 上传图片到服务器上,在页面上不能显示,急急急,在线等,求大神帮忙!!!!!

问题描述 java 上传图片到服务器上,在页面上不能显示,急急急,在线等,求大神帮忙!!!!! java 上传图片到服务器上,图片上传成功,但是在页面展示时不能加载,路径没问题,手动将上传的图片改个名字后能正常加载 解决方案 最终的上传路径有没有特殊字符或者空格啥的,最好不要带特殊字符包括空格啥的. 解决方案二: 图片在内网服务器上A,部署在服务器B的应用要显示图片,受网络限制外网用户无法访问到图片,为了解决这个问题现将图片下载到服务器B上,现在服务器B上存在图片,但是不能正常加载,通过手动地对

python2.7.3安装libxml2,导入import lxml.html报错,求大神指教

问题描述 python2.7.3安装libxml2,导入import lxml.html报错,求大神指教 系统是red hat ,自带的是2.6.6版本的python,但最近需要使用scrapy需要安装2.7.3版本的 ,通过yum install 安装的libxml2,安装成功后import lxml没有报错,但import lxml.html 时就报错了,报错信息如下: import lxml.html Traceback (most recent call last): File "&qu

编程-急求大神帮忙!!!急!!!

问题描述 急求大神帮忙!!!急!!! 编写一个C++学生成绩管理系统,能完成对10个学生成绩进行处理的相关功能.功能包括输入学生成绩.显示学生成绩.查找某一成绩.输出最高成绩.插入一个成绩.排序.退出程序等. 具体运行界面如下: 1.欢迎及相关功能选择界面 2.确定功能选择的界面 当输入1时,出现询问是否确定选择此功能. 当输入N时,出现如下界面,再次输入选择的功能编号. 如果输入其他功能时,都与输入1类似.当输入Y时,进入相关功能界面 3. 相关功能界面 (1)1输入功能界面 输入成绩后,如下

mfc c++-新人求教,我用mfc做了一个tcp fin的端口扫描器,死后得不出结果,求大神帮忙找出问题

问题描述 新人求教,我用mfc做了一个tcp fin的端口扫描器,死后得不出结果,求大神帮忙找出问题 cpp文件 // scanDlg.cpp : implementation file// #include ""stdafx.h""#include ""scan.h""#include ""scanDlg.h""#include ""afxdialogex.h&qu

unity中报错Parameter ”attack“ does not exist.恳求大神帮忙

问题描述 unity中报错Parameter "attack" does not exist.恳求大神帮忙 首先做的是按下K键 玩家由一个走路walk状态变为 attack 状态 可是测试的时候报错 Parameter "attack" does not exist. 脚本我加入了walk中. 变量 attack 要怎么加上去啊??? 解决方案 这个加入的 解决方案二: 查出有关用户 SELECT definer,type FROM mysql.proc GROUP