본문 바로가기

전체 글7

Coroutine 과 Time.timeScale 관계 Time.timeScale =0 으로 일시정지를 하니 코루틴이 멈추는 문제가 발생 yield return new WaitForSeconds(0.05f); 에서 WaitForSeconds 는 Time.timeScale에 영향을 받아 깨어나지 않는다. 대신 WaitForSecondsRealtime 을 사용하자. 2022. 4. 11.
InputField 에서 엔터를 입력해도 활성화 https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.InputField.ActivateInputField.html Unity - Scripting API: UI.InputField.ActivateInputField You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see: You've told us there are code samples on this page which don't work. .. 2022. 4. 10.
모바일 게임에서 사용하는 절전모드 화면 https://blog.unity.com/kr/technology/how-on-demand-rendering-can-improve-mobile-performance 온디맨드 렌더링을 이용한 모바일 성능 개선 | Unity Blog 포럼에서 온디맨드 렌더링을 어떻게 활용하고 있는지 알려주세요. Windows, macOS, WebGL, iOS, Android에서 Unity 에디터와 스탠드얼론 플레이어를 대상으로 테스트를 완료했으나, 피드백은 언제든지 blog.unity.com 참고해서 만들어봐야겠다.. 2022. 4. 6.
화면 꺼짐 방지 화면이 꺼지지 않게 처리 Screen.sleepTimeout = SleepTimeout.NeverSleep; 디바이스 설정에 맞추도록 처리 Screen.sleepTimeout = SleepTimeout.SystemSetting; 2022. 4. 6.
배속 / 남은시간 체크 지난 시간 체크 _setTime += Time.deltaTime; int _min = (int)_setTime / 60; float _sec = _setTime % 60; time.text = string.Format("{0:D2}:{1:D2}", _min, (int)_sec); 남은시간 체크하려면 setTime -= Time.deltaTime; 배속 조절을 Time.timeScale 으로 했을때 플레이 시간 체크하려면 Time.deltaTime 을 사용해야한다. 그러나 Stopwatch 를 사용하여 플레이 시간을 측정해서 문제 발생 using System.Diagnostics; public Stopwatch _stopWatch; Stopwatch 는 Time.timeScale 에 영향을 안받기 때문에 .. 2022. 3. 30.
빌드 후 핑크색 오브젝트 쉐이더를 등록하자. 쉐이더가 hierachy 에 등록되어야 빌드 후에 제대로 나옴. Project Setting - Graphic - Always Included Shaders에 등록하면된다고 함. 그러나 모바일 URP 지원이 안되는 에셋인지 해결안되어서 쉐이더 안쓰는 방식으로 해결 2022. 3. 29.
닉네임 검증 using System.Text.RegularExpressions; string idChecker = Regex.Replace(name, @"[^ 0-9a-zA-Z가-힣 ]", ""); if (name.Equals(idChecker) == false) return false; 설명 : @"[^ 0-9a-zA-Z가-힣 ]" => 0~9 , a~z, A~Z, 가~힣 조건식 Regex.Replace(name, @"[^ 0-9a-zA-Z가-힣 ]", ""); => 조건식에 맞지않는 문자는 모두 "" 으로 치환 if (name.Equals(idChecker) == false) => 원래 문자열과 비교하여 바뀐부분이 있는가? 2022. 3. 29.