Unity スクリプト
2016.02.04 12:38

화면에 이미지를 표시하는 스크립트(C#)

閲覧数 2666 推奨数 0 コメント 1
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷
?

Shortcut

Prev前へ 書き込み

Next次へ 書き込み

Larger Font Smaller Font 上へ 下へ Go comment 印刷

GUI를 화면에 그리는 스크립트입니다.

a는 그려질 화면의 위치 중 x좌표.

b는 그려질 화면의 위치 중 y좌표.

c는 그려질 텍스쳐의 크기 중 가로크기.

d는 그려질 텍스쳐의 크기 중 세로크기.

입니다.

스크립트를 유니티에 끌어다 놓고 보시면 None(Texture2D)라는 글이 써져있는 네모난 칸이 있는데,

그 안에 화면에 표시할 이미지를 드래그 앤 드롭하시면 됩니다.

 

[스크립트]

 

using UnityEngine;
using System.Collections;

public class menus : MonoBehaviour {
    public Texture2D button = null;
    public int a = 0;
    public int b = 0;
    public int c = 0;
    public int d = 0;

    void OnGUI() {
        GUI.DrawTexture (new Rect (a, b, c, d), button);
    }
}


 

 

?
  • profile
    천무 2016.02.04 13:25
    유니티도 보면 참 제작환경이 좋은것 같습니다.

  1. 화면에 이미지를 표시하는 스크립트(C#)

    Date2016.02.04 CategoryUnity スクリプト Byzerosium Views2666 Votes0
    Read More
  2. 유니티)캐릭터 좌우 이동 (C#)

    Date2016.01.05 CategoryUnity スクリプト Byzerosium Views1235 Votes0
    Read More
  3. [C#] 보안 64비트 정수

    Date2016.01.04 CategoryUnity スクリプト By맛난호빵 Views639 Votes0
    Read More
  4. 구간 루프 음악 스크립트

    Date2015.08.24 CategoryUnity スクリプト By맛난호빵 Views430 Votes0
    Read More
Board Pagination Prev 1 Next
/ 1