종잇장
'Study Log' 카테고리의 글 목록

Study Log

Study Log

Unity ECS Study Log - 8

[BurstCompile] public partial struct ProcessDestroyBulletJob : IJobEntity { public EntityCommandBuffer.ParallelWriter ecb; private void Execute([ChunkIndexInQuery] int chunkIndex, Entity entity, in BulletComponent bullet, in LocalTransform transform) { if (bullet.isDestroyed == true) { if (bullet.HitEffect != Entity.Null) { var hitEffectEntity = ecb.Instantiate(chunkIndex, bullet.HitEffect); ecb..

Study Log

Unity ECS Study Log - 7

1. Bullet, Character 충돌 처리 foreach ((var bullet, var bulletTransform, var bulletHitLayer) in SystemAPI.Query()) { foreach ((var character, var characterTransform, var characterHitLayer) in SystemAPI.Query()) { if (math.distancesq(new Vector2(characterTransform.ValueRO.Position.x, characterTransform.ValueRO.Position.z), new Vector2(bulletTransform.ValueRO.Position.x, bulletTransform.ValueRO.Posit..

Study Log

Unity ECS Study Log - 6

1. Burst Compiler https://docs.unity3d.com/Packages/com.unity.burst@1.8/manual/index.html About Burst | Burst | 1.8.2 docs.unity3d.com 이번에는 Burst Compiler에 대해 조금 더 찾아봤습니다. 유니티에서 소개하는 내용으로는 단점은 전혀 나오지 않아서 어떨 때 써야 하는지 명확하지 않아 좀 더 들여다보기로 했습니다. https://ko.wikipedia.org/wiki/SIMD SIMD - 위키백과, 우리 모두의 백과사전 위키백과, 우리 모두의 백과사전. ko.wikipedia.org Burst Compiler는 C#코드를 SIMD방식으로 바꾸어 Native코드로 만들어주는 컴파일러입니다. 찾..

Study Log

Unity ECS Study Log - 5

1. Unity.Physics 추가 https://docs.unity3d.com/Packages/com.unity.physics@1.0/manual/index.html Unity Physics overview | Unity Physics | 1.0.0-pre.15 Unity Physics overview The Unity Physics package, part of Unity's Data-Oriented Technology Stack (DOTS), provides a deterministic rigid body dynamics system and spatial query system. See the Unity Physics Samples for introductory material, including ..

Study Log

Unity ECS Study Log - 4

1. 이동 구현하기 public partial struct MovableSystem : ISystem { public void OnUpdate(ref SystemState state) { foreach (var (transform, movable) in SystemAPI.Query()) { Vector3 dir = Vector3.zero; if (Input.GetKey(KeyCode.UpArrow)) dir += Vector3.forward; if (Input.GetKey(KeyCode.DownArrow)) dir += Vector3.back; if (Input.GetKey(KeyCode.LeftArrow)) dir += Vector3.left; if (Input.GetKey(KeyCode.RightAr..

Study Log

Unity ECS Study Log - 3

일단 Github에 프로젝트 백업용으로 Repository를 만들었습니다. https://github.com/PieceOfPaper/Unity_ECSStudy GitHub - PieceOfPaper/Unity_ECSStudy: Unity ECS 공부용 프로젝트 Unity ECS 공부용 프로젝트. Contribute to PieceOfPaper/Unity_ECSStudy development by creating an account on GitHub. github.com 1. 샘플 에셋 추가 https://assetstore.unity.com/packages/3d/characters/robots/space-robot-kyle-4696 Space Robot Kyle | 3D 로봇 | Unity Asset S..

Study Log

Unity ECS Study Log - 2

이전에 구현에 대해 대충 감만 잡았고 이번에는 대충 어느 정도 구현해보고 앞으로 어떻게 프로젝트해보면서 공부해봐야 할지 정리를 해봤습니다. 1. 직접 구현해보기 public struct TransformTargetData : IComponentData { public float moveSpeed; } public class TransformTargetAuthoring : MonoBehaviour { public float moveSpeed = 1.0f; } public class TransformTargetBaker : Baker { public override void Bake(TransformTargetAuthoring authoring) { AddComponent(new TransformTarget..

Study Log

Unity ECS Study Log - 1

이전에 프리뷰버전으로 나왔던 Unity ECS를 봤을 때는 공부해야 할 것도 많고 써먹기도 힘들겠다 싶어서 미뤄두었는데, Unity 2022.2 테크 스트림(https://youtu.be/46qRfiAGCHs) 돌려보다가 관련 이야기가 나왔고 최신 버전이 1.0.0-pre.15 인걸로 봐서는 아직 프리뷰 버전이지만 정식 서비스에 가까워져 온 게 아닌가 싶어서 지금이라도 공부해볼까 합니다. 개념적인 부분은 다른 블로그에서 잘 쓰여있어 제가 참고한 링크만 남겨두겠습니다. https://velog.io/@cedongne/Unity-%EC%83%88%EB%A1%9C%EC%9A%B4-%EC%BB%B4%ED%8F%AC%EB%84%8C%ED%8A%B8-%EC%8B%9C%EC%8A%A4%ED%85%9C-ECS%EC%9..