素人Unity練習帳
2D迷路ゲームを作る
Goalオブジェクトと同じようにあたり判定で決める
Assets>Scriptsに
gateScrというC#Scriptをつくる
-----gateScr.cs------
using UnityEngine;
using System.Collections;
public class gateScr : MonoBehaviour {
public string quesButton;
void OnCollisionEnter(Collision other)
{
Debug.Log("Gate");
quesButton = "Gate";
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 50, 50), quesButton);
}
}
-----gateScr.cs------
上記みたいにすると
ブロックに当たると、Gateという文字は表示されるけど
ボタンは出ない。
--movie003--

そもそも、ボタンは
GUI.Button (new Rect (10,10, 100, 50), "文字列")
なので、かなり違う。
Goalオブジェクトと同じようにあたり判定で決める
Assets>Scriptsに
gateScrというC#Scriptをつくる
-----gateScr.cs------
using UnityEngine;
using System.Collections;
public class gateScr : MonoBehaviour {
public string quesButton;
void OnCollisionEnter(Collision other)
{
Debug.Log("Gate");
quesButton = "Gate";
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 50, 50), quesButton);
}
}
-----gateScr.cs------
上記みたいにすると
ブロックに当たると、Gateという文字は表示されるけど
ボタンは出ない。
--movie003--

そもそも、ボタンは
GUI.Button (new Rect (10,10, 100, 50), "文字列")
なので、かなり違う。

Reon Viewin