実現したいこと
下のエラーから出てしまいます。
Assets\Scenes\Scripts\ItemManager.cs(15,31): error CS0102: The type 'ItemManager' already contains a definition for 'GetInstance'
このエラーを直したいのですが、どこをどう訂正すればエラーは直るのでしょうか?
発生している問題・エラーメッセージ
エラーメッセージ
ソースコード ```using System.Collections; using System.Collections.Generic; using UnityEngine; public class ItemManager : MonoBehaviour { static ItemManager instance; GameObject itemDataBase; GameObject GetItemLists; GameObject GetInstance; public static ItemManager GetInstance() { return instance; } // ... // Use this for initialization void Start() { instance = this; // ... } // ... public bool HasItem(string searchName) { return itemDataBase.GetItemLists().Exists(item => item.GetItemName() == searchName); } } public static ItemManager GetInstance()のGetInstanceエラーから出ている。 using System.Collections; using System.Collections.Generic; using UnityEngine; public class KeyGet : MonoBehaviour { private Rigidbody rb; // Start is called before the first frame update void Start() { rb = GetComponent<Rigidbody>(); } // Update is called once per frame void Update() { } private void OnTriggerEnter(Collider other) { if(other.CompareTag("Key")) { Destroy(other.gameObject); } } using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Goods : MonoBehaviour { GameObject itemObject; string itemName; Image image; GameObject GetItem; private void Awake() { image = GetComponent<Image>(); } public void SetUp(Obtainable item) { image = GetComponent<Image>(); // Imageコンポーネント this.itemName = item.GetItemName(); // アイテム名を取得 // 画像を取得してImageコンポーネントに入れる image.sprite = ItemManager.GetInstance().GetItem(this.itemName).GetIcon(); this.itemObject = item.GetGameObject(); // オブジェクトを取得 } using System.Collections; using System.Collections.Generic; using UnityEngine; public class Inventory : MonoBehaviour { [SerializeField] Transform content; [SerializeField] GameObject imagePrefab; List<Goods> inventory = new List<Goods>(); static Inventory instance; public static Inventory GetInstance() { return instance; } // アイテムを取得するメソッド public void Obtain(Obtainable item) { // アイテムの存在を確認 if (ItemManager.GetInstance().HasItem(item.GetItemName())) { GameObject goodsObj = Instantiate(imagePrefab, content); // Imageインスタンスを作る Goods goods = goodsObj.GetComponent<Goods>(); // スクリプトを取得 goods.SetUp(item); // 画像などを設定 item.GetGameObject().SetActive(false); // アイテムを非アクティブにする inventory.Add(goods); // リストに入れる TextManager.GetInstance().SetText(item.GetItemName() + "を取得した", 2); } else { TextManager.GetInstance().SetText("アイテム名が無効", 2); } } private void Awake() { instance = this; } } using System.Collections; using System.Collections.Generic; using UnityEngine; public class ObtainableItem : MonoBehaviour { [SerializeField] Obtainable obt; // 取得可能クラスのオブジェクト // アイテムに触った時 public void Touch(GameObject sender, Vector3 point) { obt.Obtain(gameObject); // 取得メソッドを呼ぶ } public void Release(GameObject sender) { } } using UnityEngine; using System; public class Obtainable { [SerializeField] string itemName; GameObject gameObject; internal void Obtain(GameObject item) { gameObject = item; Inventory.GetInstance().Obtain(this); } internal string GetItemName() { return itemName; } internal GameObject GetGameObject() { return gameObject; } } どの部分が間違っているのでしょうか? 詳しく教えてください。 回答よろしくお願いします。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。