Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by dmgm · May 27, 2017 at 02:27 PM · unity 5vuforiaaugmented-realityrecognitionimage target

no extension method `GetTracker' - Vuforia + Unity

I have been following various tutorials on vuforia on building a recognition app, however I had a problem with one part of the code that I can't seem to fix.

My code gives me an error like this:

Type UnityEngine.GameObject' does not contain a definition for GetTracker' and no extension method GetTracker' of type UnityEngine.GameObject' could be found.

Is there any reason the GetTracker doesn't work? I'm new to this coding thing and I don't know what could be the problem.

Here is the whole code, in case maybe I missed something.

 public class SimpleCloudHandler : MonoBehaviour, ICloudRecoEventHandler {

 private CloudRecoBehaviour mCloudRecoBehaviour;

 private bool mIsScanning = false;

 private string mTargetMetadata = "";

 private ImageTracker mImageTracker;

 public TrackerManager mTrackerManager;

 public ImageTargetBehaviour ImageTargetTemplate;

 // Use this for initialization

 void Start ()

 {

 // register this event handler at the cloud reco behaviour

 mCloudRecoBehaviour = GetComponent<CloudRecoBehaviour>();
 
 if (mCloudRecoBehaviour)

 {

  mCloudRecoBehaviour.RegisterEventHandler(this);

 }

 }

 public void OnInitialized() {

 Debug.Log ("Cloud Reco initialized");

 }

 public void OnInitError(TargetFinder.InitState initError) {

 Debug.Log ("Cloud Reco init error " + initError.ToString());

 }

 public void OnUpdateError(TargetFinder.UpdateState updateError) {

 Debug.Log ("Cloud Reco update error " + updateError.ToString());

 }

 public class ImageTracker

 {

 }

 public class TrackerManager

 {

 public GameObject Instance;

 }



 public void OnStateChanged(bool scanning) {

 mIsScanning = scanning;

 if (scanning)

 {
  
 // clear all known trackables

 mImageTracker = mTrackerManager.Instance.GetTracker<ImageTracker>();

  //ImageTracker.TargetFinder.ClearTrackables(false);

   }

  }

  // Here we handle a cloud target recognition event

  public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult) {

    // do something with the target metadata

    mTargetMetadata = targetSearchResult.MetaData;

     // stop the target finder (i.e. stop scanning the cloud)

     mCloudRecoBehaviour.CloudRecoEnabled = false;

     if (ImageTargetTemplate) {

      // enable the new result with the same ImageTargetBehaviour:

       ObjectTracker tracker = mTrackerManager.Instance.GetTracker<ObjectTracker>();

      ImageTargetBehaviour imageTargetBehaviour =

     (ImageTargetBehaviour)tracker.TargetFinder.EnableTracking(

      targetSearchResult, ImageTargetTemplate.gameObject);

       }

      }

      void OnGUI() {

      // Display current 'scanning' status

       GUI.Box (new Rect (100, 100, 200, 50), mIsScanning ? "Scanning" : "Not scanning");

       // Display metadata of latest detected cloud-target

       GUI.Box (new Rect (100, 200, 200, 50), "Metadata: " + mTargetMetadata);

        // If not scanning, show button

        // so that user can restart cloud scanning

       if (!mIsScanning) {

        if (GUI.Button (new Rect (100, 300, 200, 50), "Restart Scanning")) {

        // Restart TargetFinder

        mCloudRecoBehaviour.CloudRecoEnabled = true;

        }

         }

         }

        }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by anakin0225 · Oct 08, 2017 at 01:13 PM

try "using UnityEngine;" instead of "using UnityEngine.GameObject;"

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Image Target Recognizer‏ 0 Answers

jump a virtual element on the target 0 Answers

Text Recognition and extended tracking AR 0 Answers

Rotate and Zoom ARCamera 3Dobject in user touch 1 Answer

Need help making AR Text recognition more interactive 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges