본문 바로가기
728x90

Unity3D/Unity & C#44

Unity & C# ~ VisualStudio 단축키 중 (내가) 자주 사용하는 단축키 최초 작성일 : 2022.07.05 최종 수정일 : 2022.07.05 디버그 F5 : 디버그 모드 실행 Shift + F5 : 디버그 중단 F10 : 다음 라인으로 F11 : 함수 내부로 F9 : 브레이크 포인트 설정/해제 Ctrl + Shift + F9 : 모든 브레이크 포인트 삭제 코드 정리 Ctrl + K, F : 선택영역 들여쓰기 자동 정리 Ctrl + K, Ctrl + S : 코드 감싸기 (#If, #region 등) 주석 Ctrl + K, C : 여러 줄 주석 Ctrl + K, U : 여러 줄 주석 해제 Ctrl + Shift + / : 블록 주석 토글(블록한 내용을 /* */ 형태 주석으로 만들어줌) 코드 자동완성 Ctrl + Space : 코드 자동완성 이동 F12 : 정의로 이동 Ctr.. 2022. 7. 5.
Unity & C# ~ UI Image Fillamount 부드럽게 움직이게 하는 법 using UnityEngine.UI; Image circleProgress; private const float loopTimeValue = 1.0f;//그리는데 걸리는 시간 public AnimationCurve loopAnimCurve; //그리는 속도를 조정해줄 애니메이션 커브 private float targetValue = 0.0f; private float currentValue = 0.0f; void Awake { targetValue = 목표값 입력; currentValue = 0; //현재값 초기화 circleProgress.fillAmount = 0.0f; //progress fillamount 초기화 StartCoroutine(MoveProgressCoroutine()); } IEn.. 2022. 7. 4.
Unity & C# ~ TMPRO에서 텍스트 길이 아는 법 TMPRO에서는 UI의 길이뿐 아니라, 현재 사용한 텍스트의 길이를 확인할 수 있는 명령어가 있다. using TMPro; TMP_Text a; void Start() { float b = a.preferredWidth; //b => a의 계산된 텍스트 폭 } 2022. 7. 1.
Unity & C# ~ Text 말 줄임표 표기 '나랏말씀이....'과 같이 ... 말 줄임표를 쓰는 법 string a = "abcdefg"; int textLength = 3; void TextLengthFunc() { if(a.length > textLength) { var b = a.Substring(0, textLength) + "..."; } } //출력 abc... string.Substring(시작할 글자 index, 글자수 value) = 시작할 글자 index부터 글자수만큼 잘라냄 2022. 7. 1.
Unity & C# ~ multipart 코드 분석 참고 블로그 : https://spirit32.tistory.com/21 [C#] multipart/form-data 파일 업로드 C# 에서 multipart/form-data로 파일 업로드하는 예제. 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51.. spirit32.tistory.com //object형식으로 만들 클래스 //파일을 전송할 때 object형식으로 보내지 않으면 형식에러가 발생함 public class FormFile { public string Name { get; set; } .. 2022. 6. 28.
Unity & C# ~ List<Class> 형식 위의 이미지와 같은 List 형식을 만드는 방법 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleList : MonoBehaviour { public ListExample listExample = new ListExample(); } [Serializable] public class ListExample { public List id; public ListExample() { id = new List(); } } [Serializable] public class ExampleGuide { public int id; public string name; p.. 2022. 6. 16.
SMALL