프레임이 떨어져요..
Concode
SetPass Calls: 5.1k
Draw Calls: 5.2k
Batches: 5232
Triangles: 66.9k
Vertices: 63.8k
(Dynamic Batching): 0
(Static Batching): 0
(Instancing): 0
Shadow Casters: 1802SetPass Calls: 2.0k
Draw Calls: 2.1k
:
Shadow Casters: 796방식 | 장점 | 단점 |
GameObject Inactive | 스크립트도 멈춤 → 성능 최적 | GC 발생 가능 재활성 시 스파이크 가능 |
Renderer.enabled | 렌더링 부하 감소 | 스크립트는 계속 실행됨 CPU 부하 여전 |
구분 | 배칭 (Batching) | 인스턴싱 (Instancing) |
핵심 | 여러 메쉬를 하나로 묶음 | 같은 메쉬를 여러 번 그림 |
처리 위치 | CPU | GPU |
메쉬 | 서로 달라도 가능 | 완전히 동일해야 함 |
머티리얼 | 같아야 함 | 같아야 함 |
오브젝트별 데이터 | 거의 불가 | float / color 등 가능 |
텍스처 변경 | ❌ | ❌ |
대표 예 | SRP Batcher | GPU Instancing |
public Material ReadyMaterial(Material template, Sprite sprite) {
// 생략
// 해시키 생성
var key = template.GetHashCode();
if (sprite != null) {
key ^= sprite.texture.GetHashCode() << 2;
}
// 캐싱된 머트리얼 반납
if (materials.TryGetValue(key, out var data)) {
data.referenceCount++;
return data.material;
}
// 텍스처별 매터리얼 생성
var mat = new Material(template);
if (sprite != null) {
// 메인 텍스처 세팅
mat.SetTexture(MainTex, sprite.texture);
// 세컨더리 텍스처 세팅
var secondaryTextureCount = sprite.GetSecondaryTextureCount();
if (secondaryTextureCount > 0) {
// ..
foreach (SecondarySpriteTexture second in secondaryTextureBuffer) {
// ..
mat.SetTexture(pid, second.texture);
}
}
}
// 텍스처 캐싱
materials.Add(key, new MaterialData {
referenceCount = 1,
material = mat,
});
return mat;
}SetPass Calls: 135
Draw Calls: 409
Batches: 409
Triangles: 28.6k
Vertices: 40.8k
(Instancing)
Batched Draw Calls: 1.5k
Batches: 307
Triangles: 23.2k
Vertices: 29.8k
Shadow Casters: 676