我有一个与点语法相关的问题。
我有这样的情况(我只粘贴相关代码部分):
using UnityEngine;
using Assets.Code.Interfaces;
using Assets.Code.Scripts;
using System.Collections; // dicionario
using System.Collections.Generic; // dicionario
namespace Assets.Code.States
if (LoadDiagram.diagramaCarga.TryGetValue(gametime, out test)) // Returns true.
{
GUI.Box (new Rect (Screen.width - 650, 275, 50, 25), test.ToString ());
}
然后我有存储此 LoadDiagram 的脚本:
using UnityEngine;
using Assets.Code.Interfaces;
using System.Collections; // dicionario
using System.Collections.Generic; // dicionario
using System;
namespace AssemblyCSharp
{
public class LoadDiagram
{
public LoadDiagram ()
{
Dictionary<int, float> diagramaCarga = new Dictionary<int, float>();
diagramaCarga.Add(0, 4.2F);
diagramaCarga.Add(1, 4F);
diagramaCarga.Add(2, 3.6F);
diagramaCarga.Add(3, 3.4F);
}
}
}
脚本之间的连接不起作用,我收到此错误:
error CS0234: The type or namespace name
Scripts' does not exist in the namespace
Assets.Code'. Are you missing an assembly reference?
在Code文件夹中,有一个名为scripts的文件夹,其中存储了这个LoadDiagram,所以我不知道如何解决这个问题。非常感谢任何帮助。
最佳答案
虽然您的文件 LoadDiagram 位于 Scripts 文件夹中,但它不在命名空间“Scripts”中。为此,请将命名空间“AssemblyCSharp”替换为“Assets.Code.Scripts”,或者仅删除该 using 语句。
关于c# - 使用 Dot 语法 c# 时 Unity 程序集引用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34168862/