好的,我正在学习使用新的 InputActions,并且我已经使用创建了一个 C# 脚本
https://prnt.sc/oyaj5l
这就是我得到的:
// GENERATED AUTOMATICALLY FROM 'Assets/PlayerControls.inputactions'
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public class PlayerControls : IInputActionCollection
{
private InputActionAsset asset;
public PlayerControls()
{
///
}
}
但是当我尝试创建 PlayerControls 对象时,我收到一条错误消息
找不到类型或命名空间名称“PlayerControls”(您是否缺少 using 指令或程序集引用?)
这是我尝试引用它的类:
using System;
using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
using UnityEngine.InputSystem;
namespace UnityStandardAssets.Characters.FirstPerson
{
public class FirstPersonController : MonoBehaviour
{
private PlayerControls controls; // ERROR HERE
}
}
包裹住PlayerControls
命名空间中的类,然后添加using
类中的声明指向您的名称空间PlayerControls
阶级生活。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)