GO with ImageTrackerBehaviour created in runtime isn't a valid tracker?

0 votes
asked Jul 17, 2018 by sophour (520 points)

In Unity I create empty game object with ImageTrackerBehaviour in runtime with following lines:

GameObject tracker = new GameObject("trackerJohn");
 ImageTrackerBehaviour trackerBehaviour = tracker.AddComponent<ImageTrackerBehaviour>();

And then assign this tracker to a target image that I create in runtime as well:

ImageTargetBehaviour targetBehaviour;
GameObject target = new GameObject("targetAmanda");
targetBehaviour = target.AddComponent<ImageTargetBehaviour>(); // In case of target this strategy works, surprisingly


I set it up with image, make them both children to EasyAR basic prefab and everything ok. Except for my trackerJohn, which is simply ignored after instantiation in scene, and image of targetAmanda is never recognized. At the same time, everything works when I assign a tracker which I've created in Unity editor and which appears in the beginning to targetAmanda.That's a discrimination! Or what do I do wrong? Why can't I instantiate  a fully functional tracker in runtime? Help me, please!

1 Answer

+1 vote
answered Jul 18, 2018 by ngc6543 (1,670 points)
selected Jul 18, 2018 by sophour
commented Jul 18, 2018 by sophour (520 points)
Oh, thank you so much, my saviour!
commented Jul 22, 2018 by ngc6543 (1,670 points)
:) thank, pal!
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.