2016-08-18 17 views
-2

Debug.logはAwake()機能では正常に動作しますが、FixedUpdate()では正常に動作しません。わからないあなたはFixedUpdateをする必要があり、関数名FixedUpdatedに余分dを追加したよう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"); 
     } 
    } 
} 

答えて

1

が見える何が間違っています。

// Update is called once per frame 
void FixedUpdated() { // <---------- should be FixedUpdate 
    ... 

また、私が試しただろう最初のものは、関数は全く呼び出されたかどうかを確認するためにFixedUpdateの開始時にDebug.Log呼び出しを追加します。呼び出されていないと、その関数に問題が発生しているはずです。それが呼び出された場合は、ログ呼び出しを囲んでいるifステートメントを指していたでしょう。

関連する問題