Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 오블완
- generic
- unity
- udon#
- sendcustomnetworkevent
- u#
- pothon
- fusion
- 제네릭
- navmash
- animator
- typeof
- navmashagent
- 유니티 네비매쉬
- Animation
- 티스토리챌린지
- 포톤
- CS
- Default
- unityai
- VRChat
- c
- c#
- 유니티
- 브이알챗
Archives
- Today
- Total
대마법사의 개발 블로그랄까?
유니티 비동기 작업에 대해 알아보자 본문
Coroutine
우선 코루틴은 멀티스레드가 아닌 메인스레드 작업이다.yield Retrun
통해 주도권을 번갈아 가며 사용하는 방식이다.
Await / Async
Await Async 즉 비동기처리이다.
private async void Start()
{
await Test();
}
private async void Test()
{
await Task.Run(()=>{// RUN으로 감싸인 부분만 비동기 처리
while(true)
{
//DoSomething ...
}
});
//비동기 처리 완료후 이후 라인 수행
//UNITY API 접근 가능
}
- Async Await 을 통해서는 Unity API에 직접적으로 접근할 수 없다.
- ex) Transform, Texture, Shader ....
- 접근시 컴파일 에러발생함
- 무거운 연산에 적합하다.
Parallel
CPU 연산에 최적화된 병렬 작업
public static System.Threading.Tasks.ParallelLoopResult For (int
fromInclusive, int toExclusive,
Action<int,System.Threading.Tasks.ParallelLoopState> body);
- 마찬가지로 UNITY API에 접근할 수 없다.
- 파일 로드/저장 정도로 사용할 수 있다.
'Unity 한테 정복당하기' 카테고리의 다른 글
Unity 멀티 Photon PUN (0) | 2025.03.23 |
---|---|
UI (0) | 2025.03.17 |
Unity 듀얼모니터에 UI 화면 출력하기 (0) | 2025.01.12 |
팀프로젝트하다가 빡쳐서 혼자서 만드는 시리즈 (1) | 2024.11.09 |