我正在使用统一的新输入系统,并得到了这个错误,我试了很多次,但找不到问题。请帮帮我。
错误:
Assets\Player01.cs(4,32): error CS0234: The type or namespace name 'Input' does not exist in the namespace 'UnityEngine.Experimental' (are you missing an assembly reference?)
完整脚本(C#):
using System.Collections;
using System.Collections.G
我试图用新的输入系统映射我的双激波4控制器,但是我得到了这个错误:
InvalidOperationException: Cannot read value of type 'float' from control '/DualShock4GamepadHID/leftStick' bound to action 'Gameplay/Movement[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/l
我遵循了在Unity中编写输入操作脚本的教程 在完成了本教程告诉我的代码之后,我在输入系统的stuff CS0246 The type or namespace name 'InputActions' could not be found的声明中得到了这个错误 导致错误的代码是: using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class GameInput : MonoBehaviour
好的,我正在学习如何使用新的InputActions,我已经创建了一个C#脚本
这就是我得到的:
// GENERATED AUTOMATICALLY FROM 'Assets/PlayerControls.inputactions'
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public class PlayerControls : IInputAct
我遵循的是"Touch sample“示例项目,它附带了"input”包。
在一个示例场景中,有一个脚本定义了自定义复合绑定(例如,2D向量组合)。
我实际上是在重写相同的脚本,只是更改了一些要添加到组合中的输入,但这会给我带来这些错误,而且由于我对编写代码还比较陌生,所以不知道如何开始解决这个问题。手册和脚本API也没有帮助。
这些都是错误
📷
这是添加自定义组合的示例脚本。
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;
using UnityE
我正在使用Unity的新输入系统。我最近删除了一些操作,现在每当我进入播放模式时都会收到以下错误。作为stated here,这个错误不会破坏任何东西,但是总是在我的控制台中看到错误是很烦人的。有没有办法刷新输入设置,以便完全删除我删除的操作,并消除此错误? Cannot find action 'Camera/New action1' with ID 'af026e96-883f-4172-ba96-2d8225a11f0f' in
'PlayerInput (UnityEngine.InputSystem.InputActionAsset
错误的日志,当我在寻找解决方案的时候,我亲自把它发到这里,也许有人碰到了,我还没有在网络上找到类似的问题,在这个错误之前的最后一个动作
所有脚本都根据它们的目录获得了一个名称空间( IDE JetBrains Rider帮助了这一点),在此之前它们都被统一在一起。为了方便起见,所有的服务都从主目录Assets/移动到Assets/Services/*ServiceName*。(这完全是练习的吗?服务: Google,Firebase,IronSource)
也许事情不一样,这个日志没有告诉我任何事情,我只是看到了一些与调试日志有关的东西,如果你能澄清这个日志是根据什么起草的,我会很高兴的。
D
当使用新的InputSystem时。如果我将一个画布组件添加到我的场景中,它会自动带来旧的EventSystem,并在我的控制台中看到这个错误:
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
UnityEngine.Input.get_mousePosition () (at <2
几分钟前,我通过package将输入系统包升级/更新为1.4.2 (版本1.4.1)。现在,每次进入播放模式并退出之后,我都会在Unity中得到相同的错误消息6次:
Type of instance in array does not match expected type
UnityEngine.InputSystem.PlayerInput:OnDisable () (at Library/PackageCache/com.unity.inputsystem@1.4.2/InputSystem/Plugins/PlayerInput/PlayerInput.cs:1734)
但是我不知道为
我正在开发C#中转换并插入到一个统一项目中的Haxe代码。
转换工作得很好,当我单独在Unity中导入类时,我能够使用生成的类。为了使其工作,我必须引入Unity生成的整个src文件夹,包括Type.cs文件。
但是,当我导入“Processing”(一个基本的统一扩展)时,我会因为名称冲突而出现错误。Type类也是一个基本的C#类,它被后置处理脚本使用。haxe-Type优先处理并中断编译:
Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs(406,30): error CS1502: The best overloaded m
由于我将我的HoloLens2统一项目更新为Unity2020.3,我已部署的HoloLens2-Application (在Unity中它们从未发生)总是抛出以下异常:
Could not create a device for 'Hand - Right (XRInputV1)'
(Exception: System.ArgumentException: Expected control positionAccuracy to be of type 'AxisControl' but is of type 'IntegerControl' i
所以我有一个c#脚本,看起来就像这样
using UnityEngine;
using System.Collections;
using System.Net;
using WebRequest;
using System.IO;
using System.Runtime;
using System.Runtime.Remoting;
public class Login_Button : MonoBehaviour {
// Use this for initialization
void Start () {
}
public static string UserName;
pub
我正忙着做一个游戏,玩家可以点击鼠标左键攻击。我有一个InputManager类,它将检查输入事件,然后调用一个UnityEvent。这都是在玩游戏的时候起作用的。但我很难在我的测试中模拟鼠标事件。下面是一个测试:
[Test]
public void MouseAttackTest()
{
var attacked = false;
var inputManagerObject = new GameObject();
var inputManager = inputManagerObject.AddComponent<InputManager>();
我开始在Unity中编写脚本,并在运行了附加的代码之后。我在unity控制台中看到这个错误。对我有任何帮助。 单位图像错误。 ? 这是我在VS中为unity运行的代码。 在此处输入代码 **using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CubeScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
大家好,我一直在开发我的第一个游戏,突然我遇到了这个错误,无法运行游戏,我已经安装了unity的新版本,但它仍然存在。我看到它可以由几个原因造成,但到目前为止还没有运气,你知道最可能的原因以及如何修复它吗?
当我选择脚本时,我唯一没有得到这个错误的地方是:
using UnityEngine;
using Assets.Code.States;
using Assets.Code.Interfaces;
public class StateManager : MonoBehaviour
{
private IStateBase activeState;
void Star
当尝试引用Unity包(特别是InputSystem)中的类时,VSCode会给出错误The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) [Assembly-CSharp],即使Unity构建和运行得很好,没有任何问题,并且为Visual Studio生成项目文件也可以正常工作。
这是在试图从Visual Studio迁移到VSCode作为我的主编辑器时开始的,
当第一次在C#中编程并使用库中的类时,在哪里可以找到在“使用”声明中必须包含的名称?
在Java中,包名总是列在类的Javadocs中。C#似乎没有分享这种规范或传统。
例如..。假设我正在编写一个C#类,以便与Unity一起使用。它可能有以下两个接近顶部的“使用”声明:
using UnityEngine;
using GoogleARCore;
但是,我最终可能需要添加一个对GvrCardboardHelpers.Recenter()的调用。当我添加时,Visual抱怨道:“名称'GvrCardboardHelpers‘在当前的命名空间中不存在。
好吧没问题..。我想我只需要为它添
我在Unity 5中设置了一个新的可脚本化对象,当我尝试设置对它的引用时,显示了一个错误:“找不到类型或命名空间名称'ES‘(您是否缺少using指令或程序集引用?”
可脚本化对象脚本:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "new ES", menuName = "ES")]
public class LAMP: ScriptableObject {
public i
我有一个问题,一个变量没有显示在检查器中,即使我已经声明了它是一个序列化的字段。
代码:
using System;
using UnityEngine;
using UnityEngine.UIElements;
public class SettingsPopup : MonoBehaviour
{
[SerializeField] private Slider speedSlider;
private void Start()
{
speedSlider.value = PlayerPrefs.GetFloat("speed",
我是一个团结的完全初学者。我在看一段YouTube视频来学习。
在视频中导入UnityEngine.SceneManagement,然后指导员使用SceneManager.LoadScene(scenename);更改场景。
当我这么做的时候,它显示出一个错误。我怎么才能解决呢?我目前正在使用Unity5.0。
Mainmenu.cs
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class mainmenu : MonoB
我开始使用Unity内部的Azure服务,并收到以下错误:
Assets\Scripts\HelloWorld.cs(8,17):错误CS0234:类型或命名空间名称'CognitiveServices‘在命名空间'Microsoft’中不存在(是否缺少程序集引用?)
这可能很简单,但我将键和区域放在SpeechConfig中,我的命名空间如下:
using UnityEngine;
using UnityEngine.UI;
using Microsoft.CognitiveServices.Speech;
#if PLATFORM_ANDROID
using UnityEn
这是我的错误
Assets\Standard Assets\Characters\ThirdPersonCharacter\Scripts\AICharacterControl.cs(7,31):
error CS0118:'NavMeshAgent' is a namespace but is used like a type
这是我的代码,我无法修复:
using System;
using UnityEngine;
namespace UnityStandardAssets.Characters.ThirdPerson.NavMeshAgent
{
[Req
这就是当我试图在Unity3D中使用我的一段代码时所得到的错误。以下是我使用的代码:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnityEngine;
using UnityEngine.Random;
public class BackgroundTile : MonoBehaviour
{
public GameObject[] dots;
// Start is called be
我在做一个Unity3D游戏。我想实现脚本Timer.cs和Collide.cs之间的连接,通过它们来交换变量obji。在你把这个问题标记为重复之前,我想提一下已经读过的问题。作为解决方案的结果,只要我得到了错误
命名空间不能直接包含成员,如字段或方法。
您能提供一个解决方案来在没有共同元素的脚本之间交换信息吗?我希望Timer.cs从Collide.cs获取变量obji
Timer.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI
包含所有可能有用的指令是否有任何危害(例如性能问题)?
例如:
using UnityEngine;
using UnityEngine.UI;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using System.Globalization;
using UnityEngine.VR
我在试着从编辑那里得到触摸事件。但是,我不会从输入操作中得到任何事件。
我有一个非常简单的脚本:
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.EnhancedTouch;
public class GameManager : MonoBehaviour
{
public InputAction _touch;
void Awake()
{
TouchSimulation.Enable();
_touch.star
我正在致力于一个Unity3D项目,它试图使用遗留粒子发射器系统。
我的脚本无法用错误CS0138编译:
Asset/MFPS/Scripts/ can /bl_Blast.cs(10,1):error CS0138:使用指令只能应用于命名空间,但UnityEngine.ParticleEmitter表示类型。考虑使用“使用静态”代替
我正在使用名为“MFPs1.0.9”的资产和Unity3D版本2018.2.0b9
下面是代码顶部的using指令:
using UnityEngine;
using UnityEngine.ParticleEmitter;
using System.C
在使用更新的Unity系统时遇到了一些重大问题,特别是在Hold交互中。我希望只在执行阶段继续运行代码,并让它持续运行,直到按键松开为止。就像这样:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
private PlayerInput playerInput;
private PlayerInputAction
我刚在完成游戏(Big)前几天就得到了统一包的新输入系统(Big),并且我遵循了一个统一学习教程,但我似乎无法让它工作。现在,我知道有一些额外的倾诉,你必须在你的项目设置和预审,我很确定我得到了所有的正确,就实际的脚本,这看起来对你们所有人吗?
using System.Collections; /*We are using the "using" keyword to signify that we are implementing the Collections class of the System package(because
unity can not use
我有一个简单的类附加在Unity中的一个按钮上:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
public class AudioButtonPlay : MonoBehaviour
{
public Button button;
void Start()
{
button = gameObject.GetComponent<Button>();
}
}
但是
尽管我已经准确地复制了教程的代码,但我无法运行我的代码。
这就是视频。代码可以在11:37看到。
我在两三天前安装了unity,所以我怀疑这是一个更新问题(我在另一个帖子上看到有人这么说)
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine;
public class controle : MonoBehaviour
{
private PlayerControls controls; // the error points
我在一个Unity3d项目中有两个文件。一个是在编辑模式下运行的测试脚本。另一个是具有静态函数的单个类,我想从测试脚本中调用这些函数。
这是我的测试脚本:
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
public class NewTestScript
{
[Test]
public void TestAnotherStaticFunction()
{
int a = NewBehaviourScr
我最近发现了URP,并正在开发一个有趣的2D游戏。我添加了一个全局2d灯光,并设置了一些代码来获取灯光组件,但unity一直在说2D灯光并不存在。unity中的错误是"error CS0246:找不到类型或名称空间名称'Light2D‘“。这就是我到目前为止所拥有的代码。我还关注了Jimmy Vegas的一篇教程,以获取系统时间。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public cl
我遵循了所有的步骤,例如将数据库SDK添加到Unity等,但是当我试图将连接时,我会得到一个错误。
Assets\Script\RealTimeLoading.cs(14,21):error CS0029:无法隐式地将“Firebase.Database.DatabaseReference”转换为“DatabaseReference”
我跟读了很多教程,他们从来没有犯过错误,只有我。这是我的密码
using Firebase;
using Firebase.Database;
using Firebase.Unity.Editor;
using System.Collections
我一直在为我的Unity3D游戏创建基于鼠标的运动。我已经得到了移动,但我有困难设置一个变量的移动速度,我可以修改使用技能。这是我第一次尝试使用C#,而且我非常缺乏经验。这是一个长期项目的开始,所以任何帮助或建议都将不胜感激。
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.AI;
namespace EO.ARPGInput
{
[RequireComponent(typeof(NavMeshAgent))]
public class PlayerController : MonoBeha