일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 유니티
- 유니티 미연시
- 게임 개발 독학
- 오픽 im1
- ETRI 연구연수
- 유니티 스토리
- unity 게임
- 유니티 체스
- unity 설치
- 크래프톤 정글 게임랩
- 크래프톤 게임 정글 랩
- 유니티 독학
- node.js
- 유니티 대화
- 크래프톤
- 크래프톤 정글랩
- protobuf란
- unity 강의
- unity
- 오픽 im1 5일
- 게임 개발
- unity 개발
- unity 공부
- Unity Chess
- Unity 독학
- 크래프톤 정글 게임 랩
- unity 게임 개발
- 게임 독학
- protobuf 란?
- 유니티 퀘스트
- Today
- Total
하참이의 아이디어노트
Unity troubleshooting (1) error CS0104: 'Debug' is an ambiguous reference between 'UnityEngine.Debug' and 'System.Diagnostics.Debug' 본문
Unity troubleshooting (1) error CS0104: 'Debug' is an ambiguous reference between 'UnityEngine.Debug' and 'System.Diagnostics.Debug'
하참이 2024. 11. 15. 16:11
유니티 게임 서버 관련 공부를 하다 생긴 오류이다.
직역하면 Debug가 모호하다는 내용이다.
에러 코드는 다음과 같다.
using DummyClient;
using ServerCore;
using System.Diagnostics;
using UnityEngine;
class PacketHandler
{
public static void S_ChatHandler(PacketSession session, IPacket packet)
{
S_Chat chatPacket = packet as S_Chat;
ServerSession serverSession = session as ServerSession;
if (chatPacket.playerId == 1)
Debug.Log(chatPacket.chat);
}
}
위 코드를 실행하면 다음과 같은 오류가 나타남을 확인 할 수 있다.
Assets\Scripts\Packet\PacketHandler.cs(14,13): error CS0104: 'Debug' is an ambiguous reference between 'UnityEngine.Debug' and 'Systehttp://m.Diagnostics.Debug'
본론부터 말하면 3행의
using System.Diagnostics;
이 4행의
using UnityEngine;
와 겹쳐서 나는 오류이다. UnityEngine을 지울 수 없으니 3행을 지워 코드를 완성한다.
using DummyClient;
using ServerCore;
using UnityEngine;
class PacketHandler
{
public static void S_ChatHandler(PacketSession session, IPacket packet)
{
S_Chat chatPacket = packet as S_Chat;
ServerSession serverSession = session as ServerSession;
if (chatPacket.playerId == 1)
Debug.Log(chatPacket.chat);
}
}
찾아보니 흔히 C#에서 서버 환경을 구현해놓고 Unity 환경으로 옮길 때 발생하는 오류인 것 같다. 검색하면 바로 나오는 내용이긴 하나 비슷한 오류와 자주 만날 수 있으니 알아두면 좋을 것 같다.
-- 참고 자료 --
Ambiguous reference CS0104: 'Debug' is an ambiguous reference between'UnityEngine.Debug' and 'System.Diagnostics.Debug'
I am new to programming and need help to fix error pop-up, which appeared after writing if statement in code, 5 error codes for all Debug.Log lines, before if statement they were working fine. ...
stackoverflow.com
https://www.youtube.com/watch?v=slGVc0fipI8
'Unity' 카테고리의 다른 글
유니티 실무 (1) - Drag And Drop (0) | 2024.03.05 |
---|---|
Hello, Unity! (0) | 2023.07.18 |