Input
- accelerationEventCount
- accelerationEvents
- acceleration
- anyKeyDown
- anyKey
- compositionCursorPos
- compositionString
- deviceOrientation
- eatKeyPressOnTextFieldFocus
- GetAccelerationEvent
- GetAxisRaw
- GetAxis
- GetButtonDown
- GetButtonUp
- GetButton
- GetJoystickNames
- GetKeyDown
- GetKeyUp
- GetKey
- GetMouseButtonDown
- GetMouseButtonUp
- GetMouseButton
- GetPosition
- GetRotation
- GetTouch
- gyro
- imeCompositionMode
- inputString
- isGyroAvailable
- mousePosition
- multiTouchEnabled
- ResetInputAxes
- touchCount
- touches
Input.touches 触摸列表
static var touches : Touch[]
Description描述
Returns list of objects representing status of all touches during last frame (Read Only) (Allocates temporary variables).
返回代表上一帧所有的触摸状态的对象列表(只读)(分配临时变量)
Each entry represents a status of a finger touching the screen.
每个记录都代表着一个手指在屏幕上的触碰状态
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
int fingerCount = 0;
foreach (Touch touch in Input.touches) {
if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
fingerCount++;
}
if (fingerCount > 0)
print("User has " + fingerCount + " finger(s) touching the screen");
}
}
// Prints number of fingers touching the screen
//输出触摸在屏幕上的手指数量
function Update () {
var fingerCount = 0;
for (var touch : Touch in Input.touches) {
if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
fingerCount++;
}
if (fingerCount > 0)
print ("User has " + fingerCount + " finger(s) touching the screen");
}
最后修改:2011年3月11日 Friday 19:07