2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

"Unity"+"leap motion" [練習八つ]: VRGUI Project

Last updated at Posted at 2015-12-01

VRGUI Project: 「uGUIを作りましょう」

Goal: 空間に浮かぶGUIを作る

  • Step 1: UnityでLeap Motionを使ってGesture Motion認識ができる。
  • Step 2: uGUIでメニューを作って空間に浮かべる
  • Step 3:メニュー選択。任意のGameObjectからRaycastを飛ばしてメニューを選択できる。選択状態で色を変える。できたら音も。
  • Step 4:メニューで選択した項目を実行。メニューに任意のアクションを割り当てられるように実行する。

  • Sword of Art Onlineで出るメニュのイメージをDownloadする。
Screen Shot 2015-12-01 at 14.45.16.png
  • Unityで前に作ったButton Menu demoにon/offのイメージをAdd

Screen Shot 2015-12-01 at 14.36.13.png

on image 列
Screen Shot 2015-12-01 at 14.36.32.png

off image 列
Screen Shot 2015-12-01 at 14.56.56.png

Screen Shot 2015-12-01 at 15.54.45.png


  • scriptでraw_imageを追加する
button-demo
RawImage[] GUIimages = GetComponentsInChildren<RawImage>();
foreach(RawImage image in GUIimages){
			image.enabled = status;
		}
  • set Activeを利用して、toggle効果を適用する。
setActive
public ButtonDemoGraphics onGraphics;
public ButtonDemoGraphics offGraphics;

private void TurnsOnGraphics()
  {
    onGraphics.SetActive(true);
    offGraphics.SetActive(false);
  }

  private void TurnsOffGraphics()
  {
    onGraphics.SetActive(false);
    offGraphics.SetActive(true);
  }

  • 結果

結果見る

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?