【发布时间】:2014-06-20 21:49:58
【问题描述】:
我通过转到游戏对象>>创建其他>>GUI纹理添加了GUITexture,并在检查器中添加了它的纹理我现在想要的是当用户触摸(游戏适用于android和IOS)GUITexture向上移动立方体时我试过这段代码
var up : GUITexture;
var player : Rigidbody2D;
function Update () {
for (var evt : Touch in Input.touches) {
var HitTest1 = up.HitTest(evt.position);
if (evt.phase == TouchPhase.Began) {
if(HitTest1){
player.rigidbody2D.AddForce(Vector2(-2,0));
fireButton.enabled = false;
}
}
}
}
但它没有用。我能做什么?
【问题讨论】:
标签: button unity3d unityscript