2016-07-26 5 views
1

しかし、変数:アクセス九段イベント、九段のSampleAppスクリプトに続いて別のスクリプト

using UnityEngine; 
using System.Collections; 

namespace Kudan.AR.Samples 
{ 
    /// <summary> 
    /// Script used in the Kudan Samples. Provides functions that switch between different tracking methods and start abitrary tracking. 
    /// </summary> 
    public class SampleApp : MonoBehaviour 
    { 
     public KudanTracker _kudanTracker; // The tracker to be referenced in the inspector. This is the Kudan Camera object. 
     public TrackingMethodMarker _markerTracking; // The reference to the marker tracking method that lets the tracker know which method it is using 
     public TrackingMethodMarkerless _markerlessTracking; // The reference to the markerless tracking method that lets the tracker know which method it is using 

     public void MarkerClicked() 
     { 
      _kudanTracker.ChangeTrackingMethod(_markerTracking); // Change the current tracking method to marker tracking 
     } 

     public void MarkerlessClicked() 
     { 
      _kudanTracker.ChangeTrackingMethod(_markerlessTracking); // Change the current tracking method to markerless tracking 
     } 

     public void StartClicked() 
     { 
      // from the floor placer. 
      Vector3 floorPosition;   // The current position in 3D space of the floor 
      Quaternion floorOrientation; // The current orientation of the floor in 3D space, relative to the device 

      _kudanTracker.FloorPlaceGetPose(out floorPosition, out floorOrientation); // Gets the position and orientation of the floor and assigns the referenced Vector3 and Quaternion those values 
      _kudanTracker.ArbiTrackStart(floorPosition, floorOrientation);    // Starts markerless tracking based upon the given floor position and orientations 
     } 
    } 
} 

私は九段の同じ名前空間を使用してスクリプトを作成する必要が九段の機能/イベント/変数にアクセスします。私はそれほど多くの名前空間を理解していないので、これが持つ可能性のある上下が何であるか分かりません。

私の質問は、同じ名前空間でスクリプトを作成することなく、それらの変数/関数/ etcにアクセスできますか?もしそうなら、どうですか?

これは私にとってはあまりにも基本的すぎると私は謝罪し、ありがとう。

答えて

1

スクリプト全体で同じ名前空間を使用しない場合は、変数を宣言するときに明示的に名前空間を記述する必要があります。

ので、代わりに言っての:

namespace Kudan.AR.Samples 
{ 
    public class SampleApp 
    { 
     public KudanTracker _kudanTracker; 
    } 
} 

は、あなたが言う:

public class SampleApp 
{ 
    public Kudan.AR.KudanTracker _kudanTracker; 
} 

の詳細情報については、私はhow to use Namespacesを探してお勧めします。

+0

ありがとう、それは私が必要としていたものです! – jFelipe

関連する問題