-2
Debug.log在Awake()
函数中正常工作,但不在FixedUpdate()
中正常工作。不知道什么是错的调试日志不适用于固定更新
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(SteamVR_TrackedObject))]
public class PickupParent : MonoBehaviour {
SteamVR_TrackedObject trackedObj;
void Awake() {
trackedObj = GetComponent<SteamVR_TrackedObject>();
Debug.Log("debug log is working");
}
// Update is called once per frame
void FixedUpdated() {
SteamVR_Controller.Device device = SteamVR_Controller.Input((int)trackedObj.index);
if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger))
{
Debug.Log("You are holding down the 'Touch' on the Trigger");
}
}
}