HUOUOZUINIU 2022-01-07 19:32 采纳率: 0%
浏览 353

这个CS0111怎么解决,请求各位


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;




public class MouseManager : MonoBehaviour
{
    public static MouseManager Instance;
    RaycastHit hitInfo;
    public event Action<Vector3> OnMouseClicked;


    void Awake()
    {
        if (Instance != null) 
            Destroy(gameObject);

        Instance = this;

    }

    void Update()
    {
        SetCursorTesture();
        MouseControl();
    }

    void SetCursorTesture()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hitInfo))
        { 
            //切换鼠标贴图
        }
    }


    void MouseControl()
    {
        if (Input.GetMouseButtonDown(0) && hitInfo.collider != null)
        {
            if (hitInfo.collider.gameObject.CompareTag("Ground"))
                OnMouseClicked?.Invoke(hitInfo.point);
        }
    }
}

然后它就给我报错CS0111

  • 写回答

2条回答 默认 最新

  • 奈何墨漪笑 2022-08-29 10:42
    关注

    我写一个helloword都能跳出来CS0111错误。。。。。。。。

    评论

报告相同问题?

问题事件

  • 创建了问题 1月7日