728x90
반응형
728x170
public Image image;
void Start() { LoadImage(FilePath); }
private void LoadImage(string path) { byte[] byteTexture = System.IO.File.ReadAllBytes(path); Texture2D texture = new Texture2D(0, 0); texture.LoadImage(byteTexture);
Rect rect = new Rect(0, 0, texture.width, texture.height); image.sprite = Sprite.Create(texture, rect, new Vector2(0.5f, 0.5f)); }
|
image 변수에 Image 를 할당해 주면 그곳에 경로의 이미지가 나타나게된다.
728x90
반응형
그리드형
'Unity' 카테고리의 다른 글
[Unity] Galaxy S21 (Android 11) 에서 AR Camera 동작 시 앱이 죽는 경우 (1) | 2021.10.07 |
---|---|
[Unity] Android device is not responding (0) | 2021.08.19 |
[Unity] Camera 이동 Script (0) | 2021.07.28 |
[Unity] Unity 를 원하는 Visual Studio 버전에 연결하기 (0) | 2021.07.15 |
[Unity] Android Back Button 처리하기 (0) | 2021.07.07 |
댓글을 달아 주세요