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 |
Tags
- 백준스택
- 이것이자바다
- 백준평범한배낭
- 이것이자바다9장
- 딥러닝
- 웹개발기초
- 윤곽선검출
- 코드트리
- 2019카카오코테
- 확인문제
- 백준가운데를말해요
- java
- 스파르타코딩클럽
- 백준괄호
- 코딩테스트실력진단
- 냅색알고리즘
- BOJ1655
- 백준
- 합성곱연산
- 운영체제
- 가운데를말해요
- 컴퓨터비전
- BOJ
- 카카오코테
- 백준9012
- 백준10828
- KT포트포워딩
- 코테
- 백준온라인저지
- 이것이자바다확인문제
Archives
- Today
- Total
코딩하는 락커
Unity C# Sprite → Textrue 2D로 변경 본문
참고
https://answers.unity.com/questions/651984/convert-sprite-image-to-texture.html
public static Texture2D textureFromSprite(Sprite sprite)
{
if(sprite.rect.width != sprite.texture.width){
Texture2D newText = new Texture2D((int)sprite.rect.width,(int)sprite.rect.height);
Color[] newColors = sprite.texture.GetPixels((int)sprite.textureRect.x,
(int)sprite.textureRect.y,
(int)sprite.textureRect.width,
(int)sprite.textureRect.height );
newText.SetPixels(newColors);
newText.Apply();
return newText;
} else
return sprite.texture;
}
이것도 정말정말 많이 썼던 코드
'[2021] 🎓 졸업작품 > [2021] 🎮 Unity' 카테고리의 다른 글
Unity C# GameObject 이름 GameObject 찾기 (0) | 2021.12.23 |
---|---|
Unity C# EventSystem으로 선택된 Gameobject 가져오기 (0) | 2021.12.23 |
Unity C# Texture2D → Sprite로 변경 (0) | 2021.12.23 |
Unity C# <Images>의 source image 변경 (0) | 2021.12.23 |
Unity C# Text Color 수정 (0) | 2021.12.23 |
Comments