• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    해결됨

ArgumentException 에러가 생겼습니다.

23.10.11 00:58 작성 조회수 630

1

ArgumentException: An item with the same key has already been added. Key: 1

System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <1c8569827291471e9db0dcd976e97952>:0)

System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <1c8569827291471e9db0dcd976e97952>:0)

RPG.Data.StatData.MakeDict () (at Assets/02.Scrips/Data/Data.Contents.cs:28)

RPG.Managers.DataManager.Init () (at Assets/02.Scrips/Managers/DataManager.cs:21)

RPG.Managers.Managers.Init () (at Assets/02.Scrips/Managers/Managers.cs:53)

RPG.Managers.Managers.get_Instance () (at Assets/02.Scrips/Managers/Managers.cs:10)

RPG.Managers.Managers.get_Resource () (at Assets/02.Scrips/Managers/Managers.cs:23)

RPG.Scenes.BaseScene.Init () (at Assets/02.Scrips/Scenes/BaseScene.cs:22)

RPG.Scenes.GameScene.Init () (at Assets/02.Scrips/Scenes/GameScene.cs:14)

RPG.Scenes.BaseScene.Awake () (at Assets/02.Scrips/Scenes/BaseScene.cs:15)

 

이렇게 에러가 생겼는데 이미 Dictionary가 생겨났다는데 Init()함수 순서 문제인건지 모르겠습니다.

답변 1

답변을 작성해보세요.

1

ArgumentException: An item with the same key has already been added. Key: 1

같은 키값 1로 두 번 추가해서 그런데 혹시 왜 그런지 breakpoint를 걸어보세요

용현박님의 프로필

용현박

질문자

2023.10.11

이런 말씀 드리면 좀 그렇지만 감히 사랑한다 말씀드리고 싶습니다.

해결 완료되었습니다.