C# 调试日志不适用于FixeUpdate
Debug.log在C# 调试日志不适用于FixeUpdate,c#,unity3d,C#,Unity3d,Debug.log在Awake()函数中工作正常,但在fixeupdate()中工作不正常。不知道怎么了 using UnityEngine; using System.Collections; [RequireComponent(typeof(SteamVR_TrackedObject))] public class PickupParent : MonoBehaviour { SteamVR_TrackedObject trackedObj; void Awake ()
Awake()
函数中工作正常,但在fixeupdate()
中工作不正常。不知道怎么了
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");
}
}
}
使用UnityEngine;
使用系统集合;
[所需组件(类型(SteamVR_TrackedObject))]
公共类拾取者:单行为{
SteamVR_TrackedObject TrackedObject;
无效唤醒(){
trackedbj=GetComponent();
Log(“调试日志正在工作”);
}
//每帧调用一次更新
无效固定更新(){
streamvr_Controller.Device=streamvr_Controller.Input((int)trackedbj.index);
if(device.GetTouch(streamvr\u Controller.ButtonMask.Trigger))
{
Log(“您正在按下触发器上的“触摸”);
}
}
}
看起来您在函数名中添加了一个额外的d
,FixedUpdate
应该是FixedUpdate
// Update is called once per frame
void FixedUpdated () { // <---------- should be FixedUpdate
...
//每帧调用一次更新
void FixedUpdated(){//