Log in or register to post comments

TargetFinder error

March 24, 2019 - 9:15pm #1

I`m building an app using cloud recognition to play an URL video.

Console gives me these two errors, I think it`s an error with the new update. can someone please help.

**************************************************************************************************************************************

Unsupported TargetFinder type provided

UnityEngine.Debug:LogError(Object)

Vuforia.ObjectTracker:GetTargetFinder()

SimpleCloudHandler:OnNewSearchResult(TargetSearchResult) (at Assets/SimpleCloudHandler.cs:49)

Vuforia.ObjectRecoBehaviour:Update()

*******************************************************************************************************************************************************

NullReferenceException: Object reference not set to an instance of an object

SimpleCloudHandler.OnNewSearchResult (Vuforia.TargetFinder+TargetSearchResult targetSearchResult) (at Assets/SimpleCloudHandler.cs:49)

Vuforia.ObjectRecoBehaviour.Update () (at <d17b882acd8f40e982e2cd7d407d5aeb>:0

*********************************************************************************************************************************************************************

*****this is my OnNewSearchResult,

public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)

    {

        TargetFinder.CloudRecoSearchResult cloudRecoSearchResult = (TargetFinder.CloudRecoSearchResult)targetSearchResult;

        Debug.Log("CloudReco: new search result available: " + targetSearchResult.TargetName);

        GameObject newImageTarget = Instantiate(behaviour.gameObject) as GameObject;

        MainPlayer = newImageTarget.transform.GetChild(0).gameObject;

        GameObject augmentation = null;

        if (augmentation != null)

        {

            augmentation.transform.SetParent(newImageTarget.transform);

        }

        if (behaviour)

        {

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

            ImageTargetBehaviour imageTargetBehaviour = (ImageTargetBehaviour)tracker.GetTargetFinder<TargetFinder>().EnableTracking(targetSearchResult, newImageTarget);

        }

        string URL = cloudRecoSearchResult.MetaData;

        MainPlayer.GetComponent<VideoPlayer>().url = URL.Trim();

        cloud.CloudRecoEnabled = true;

    }

TargetFinder error

March 27, 2019 - 2:02am #2

Really hard to debug this for you with the lack of context. From the code you posted, what strikes me as weird is why you check for null of the behaviour (if(behaviour)) but above you access behaviour.gameObject without a null check.

Also, not relevant to this post, but you can remove all of this: augmentation = null, followed by if(augmentation != null) {...}

Log in or register to post comments