我有一個與點語法相關的問題。使用點語法時的Unity Assembly參考錯誤c#
我有這個條件(我只粘貼相關的代碼部分):
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?
在文件夾代碼中,有af存儲此LoadDiagram的較早的命名腳本,所以我不知道如何解決此問題。任何幫助深表謝意。
如果您發佈實際代碼,則可能會得到更多相關答案;在當前狀態下的片段是無效的,re:'如果(LoadDiagram.diagramaCarga.TryGetValue(gametime,out test))'應該在方法中的類中。 –