Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified 2회차/3주차/정성찬/Image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 2회차/3주차/정성찬/Image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes.
18 changes: 0 additions & 18 deletions 2회차/3주차/정성찬/ObjectPool.md

This file was deleted.

59 changes: 59 additions & 0 deletions 2회차/4주차/정성찬/Batching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Batching이란?

## Draw Call

- 컴퓨터에 CPU, GPU가 있는데 CPU는 데이터를 읽는 역할을 하고 GPU가

이 데이터를 읽고 해석해서 컨텐츠를 그리는 역할을 하는데 이 작업을

Draw Call이라한다


![](./Image1.png)

## SetPass Call

- Draw Call을 할때 커맨드 버퍼라이트라는 데이터들이 따라오는데 이중에서 Material이나

Shader를 묶어놓은 것들이 SetPass이고 이걸 전달하는것이 SetPass Call이다


![](./Image2.png)

## Batch

- 위에서 DrawCall, SetPassCall과 그래픽을 구성하고 있는 데이터들도 포장해서 GPU한테

넘기는 것을 Batch라 하는데 Batch수가 많으면 부하가 많이 걸리는데 이걸 줄이는것을

최적화라고 부른다


# 최적화 예시

## 1. 동적 Batcing

![](./Image3.png)

*일반적인 Material

![](./Image4.png)

최적화를 하지않은 일반적인 상황일때 Batch의 수와 SetPass Call수가 같은 최적화가 전혀 되지않는다

![](./Image5.png)

*Material을 합친 상태

![](./Image6.png)

Material을 합쳐 최적화를 시켰을때 SetPass Call이 3배 정도 줄어들어 최적화가 되는 모습이다

위와 같은 방법으로 2D에서 Sprite도 최적화 할 수 있습니다

---

## 2. 정적 Batcing

![](./Image7.png)
이 방법은 오브젝트가 static이 되기 때문에 Transform이 움직이지 않는 단점이 있다
Binary file added 2회차/4주차/정성찬/Image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/4주차/정성찬/Image7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 139 additions & 0 deletions 2회차/5주차/정성찬/Cammand Pattern.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# 커맨드 패턴
## 커맨드 패턴이란?

**커맨드**는 요청을 요청에 대한 모든 정보가 포함된 독립실행형 객체로 변환하는 행동 디자인 패턴입니다. 이 변환은 다양한 요청들이 있는 메서드들을 인수화 할 수 있도록 하며, 요청의 실행을 지연 또는 대기열에 넣을 수 있도록 하고, 또 실행 취소할 수 있는 작업을 지원할 수 있도록 합니다.

![](./Image1.png)


## 커맨드 패턴을 사용하는 이유
![](./Image2.png)
여러 버튼 자식클래스를 가지고 Click()으로 기능을 각각 실행 시키고 싶은 기능을 실행한다 하면

자식 클래스를 많이 가질수록 *분기가 많아지고 *OCP(개방 폐쇠 원칙)에서도 위반된다.
---

분기 : 분기란 if문 같은 조건문으로 선택적으로 코드를 실행 시키는 것이다

OCP : 코드를 수정 할 때 다른 스크립트들도 다 수정 해주는 귀찮은 상황을 만들지 않는 것

## 코드 예시

```csharp
using System;

namespace RefactoringGuru.DesignPatterns.Command.Conceptual
{
public interface ICommand
{
void Execute();
}

class SeongChan : ICommand
{
private string _payload = string.Empty;

public SeongChan(string payload)
{
this._payload = payload;
}

public void Execute()
{
Console.WriteLine($"성찬 : 걍 끝내고 {this._payload} 가자아아아");
}
}


class Minheok : ICommand
{
private Jinwoo _jin;


private string _a;

private string _b;


public Minheok(Jinwoo receiver, string a, string b)
{
this._jin = receiver;
this._a = a;
this._b = b;
}


public void Execute()
{
Console.WriteLine("민혁 : 잠만잠만, 진우가 P같이 오류 확인한데");
this._jin.DoSomething(this._a);
this._jin.DoSomethingElse(this._b);
}
}


class Jinwoo
{
public void DoSomething(string a)
{
Console.WriteLine($"진우 : {a}");
}

public void DoSomethingElse(string b)
{
Console.WriteLine($"진우 : {b}");
}
}


class Hyechan
{
private ICommand _onStart;

private ICommand _onFinish;


public void SetOnStart(ICommand command)
{
this._onStart = command;
}

public void SetOnFinish(ICommand command)
{
this._onFinish = command;
}


public void DoSomethingImportant()
{
Console.WriteLine("혜찬 : 우리 프로젝트 마무리 할건데 더 할거 없지?");
if (this._onStart is ICommand)
{
this._onStart.Execute();
}

Console.WriteLine("혜찬 : 그럼 프로젝트 마무리할게");

Console.WriteLine("혜찬 : 지금 머지한다");
if (this._onFinish is ICommand)
{
this._onFinish.Execute();
}
}
}

class Program
{
static void Main(string[] args)
{

Hyechan hye = new Hyechan();
hye.SetOnStart(new SeongChan("풍년"));
Jinwoo jin = new Jinwoo();
hye.SetOnFinish(new Minheok(jin,"아니 그 정돈 할 수 있잖아", "이야 오류가 없네요"));

hye.DoSomethingImportant();
}
}
}
```
Binary file added 2회차/5주차/정성찬/Image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/5주차/정성찬/Image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2회차/6주차/정성찬/Image6.png
Binary file added 2회차/6주차/정성찬/Image7.png
Binary file added 2회차/6주차/정성찬/Image8.png
Binary file added 2회차/6주차/정성찬/Image9.png
97 changes: 97 additions & 0 deletions 2회차/6주차/정성찬/Sqlite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Sqlite 저장

# SQLite 저장 특징

유니티에서 데이터를 저장하는 방법은 여러가지인데 Json,PlayerPrefs,Sqlite가 있다. 이중에서

Sqlite는 경량화, 안정성, 빠른 처리 속도, 유저가 데이터를 바꿀 수 없다는 장점이 있다.

# 사용 전 세팅

### 1.

![](./Image1.png)

먼저 SQLite로 들어가 zip파일을 다운받고 sqlite3.dll과 sqlite3.def를 다운한다

### 2.

![](./Image2.png)

버전에 맞는 에디터에서 Data > MonoBleedingEdge > lib > mono > 2.0-api > Mono.Data.Sqlite.dll

을 찾는다

### 3.

![](./Image3.png)
Plugins파일을 만들고 안에 Mono.Data.Sqlite.dll과 sqlite3.dll, sqlite3.def파일을 넣는다

4.

![](./Image4.png)
Exel로 데이터를 넣어준 뒤에 CSV파일로 저장한다

5.

https://sqlitebrowser.org/dl/

![](./Image5.png)

zip파일 다운로드후에 **DB Browser for SQLite.exe를 실행한다**

6.

![](./Image6.png)

왼쪽 위에 새 데이터 베이스를 클릭한 뒤에 파일 이름을 입력한다

![](./Image7.png)

새로 테이블 정의 변경이란 창이 뜨지만 바로 닫아 준다

7.

![](./Image8.png)

‘파일 > 가져오기 > CSV파일에서 테이블 가져오기’를 한다

8.

![](./Image9.png)

가져 왔을때 한글이 깨지는 경우가 있는데

![](./Image10.png)
전에 만든 Exel파일을 메모장으로 열고

![](./Image11.png)

인코딩을 ANSI에서 UTF-8로 바꾼뒤 저장한다

9.

![](./Image12.png)

정상적으로 된다면 확인을 눌러준다

10.

![](./Image13.png)
만들어진 db파일을 StreamingAssets에 넣는다

# 사용 코드

![](./Image14.png)

상단에 using System.Data와 using Mono.Data.Sqlite를 써넣고 dbname에는 “/파일이름”으로 넣어준다

![](./Image15.png)

데이터 읽기 코드

![](./Image16.png)

데이터 코드 쓰기

출처 : [https://ctkim.tistory.com/entry/Unity-Unity에-Sqlite-연동하기DB-읽기-쓰기#google_vignette](https://ctkim.tistory.com/entry/Unity-Unity%EC%97%90-Sqlite-%EC%97%B0%EB%8F%99%ED%95%98%EA%B8%B0DB-%EC%9D%BD%EA%B8%B0-%EC%93%B0%EA%B8%B0#google_vignette)
Binary file removed 3회차/Image1.png
Diff not rendered.
Binary file removed 3회차/Image2.png
Diff not rendered.
20 changes: 0 additions & 20 deletions README.md

This file was deleted.