Hi,
I created the app that using model target and i managed to create a button to change the current guide view. The app works perfectly while i am working on PC and tested on Android.
But when i open the project on Mac and tested on Iphone, the apps has a bug. I checked it and found out the ModelTargetBehaviour.ModelTarget reference is null.
In editor, database and model target in ModelTargetBehaviour gameobject is set correctly even in Play Mode, it is not Empty.
This is my script to access the model target.
private ModelTargetBehaviour _modelTargetBehaviour; private void Start() { _modelTargetBehaviour= GetComponent<ModelTargetBehaviour>(); } public void GuideView(int toggleId) { if (_modelTargetBehaviour!= null) { ModelTarget modelTarget = _modelTargetBehaviour.ModelTarget; modelTarget.SetActiveGuideViewIndex(toggleId); //here is the error but only on iOS, modelTarget is null reference } }
Hi,
I used Vuforia 6.9.3 and Unity 2019.4.7
I found this error occurs because my ModelTarget script used before the apps asks for camera permission at the first instalation. I resolve this by added new scene to request permission before enter AR scene.