본문 바로가기
아니때려치치마(unity)

유니티)JSON 이용시 빌드 후 NotSupportedException 에러날때

by 때려쳐아니때려치지마 2022. 3. 30.
반응형

에러내용)

NotSupportedException: System.Reflection.Emit.DynamicMethod::.ctor

  at System.Reflection.Emit.DynamicMethod..ctor (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, System.Boolean skipVisibility) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateArrayContract (System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <00000000000000000000000000000000>:0 

  at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <00000000000000000000000000000000>:0 

  at DataManager.ReadSongData () [0x00000] in <00000000000000000000000000000000>:0 

  at MainManager.Start () [0x00000] in <00000000000000000000000000000000>:0 

 

에러 사유)

https://shakddoo.tistory.com/entry/Unity-Json-Parser-JsonNet-for-Unity

위 블로그에 자세하게 나와있다

근데 나는 추가적인 오류가 나왔다

 

추가에러 및 해결)

JSON .NET for Unity 에셋을 다운받고나서 

package.json에서 

{
  "scopedRegistries": [
    {
      "name": "Packages from jillejr",
      "url": "https://npm.cloudsmith.io/jillejr/newtonsoft-json-for-unity/",
      "scopes": [ "jillejr" ]
    }
  ],
  "dependencies": {
    "jillejr.newtonsoft.json-for-unity": "12.0.201",
	//그외의것들...
    }
}

이렇게 추가하여 수정할경우

Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included or the current platform. Only one assembly with the same name is allowed per platform. 

해당 오류가남

패키지에서 해당 제이슨이 들어있고 다운받은 에셋에도 들어있어서 중복되고있었다

버전이 달라서 그런거같음 근데 내가 다운받은 에셋버전의 url을 몰라서 그냥 에셋을 삭제했다

다운받은 에셋을 삭제해주고 위 코드로 package > manifest.json을 통해서 받은거만 남겨서 사용함

 

 

 

반응형

댓글