簡體   English   中英

錯誤 CS0246,unity 找不到命名空間

[英]error CS0246, unity cannot find a namespace

我會盡量總結我的問題,但我對使用這個程序很陌生。

我想統一引用一個游戲管理器,以便我可以使用我在不同腳本中創建的某些值。 完整的錯誤是這樣的:

Assets\\FightingIdle.cs(8,12):錯誤 CS0246:找不到類型或命名空間名稱“GameManager”(您是否缺少 using 指令或程序集引用?)

這是我的代碼:

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

public class FightingIdle : MonoBehaviour
{
    public GameManager GM;
    // Start is called before the first frame update
    void Start()
    {

}

// Update is called once per frame
void Update()
{

}

void VechtKnop()
{
    GM.FightPoints += GM.FightDamage;
}

}

問題出現在這里:'public GameManager GM;'

由於某種原因,unity 找不到類型/命名空間。 誰能幫我解決這個問題?

  • 轉到您的GameManger.cs
  • 找到以namespace <anything>開頭的行
  • 復制那個<anything>
  • using <anything>將其添加到 FightingIdle 的頂部

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM