Hi,I was using the following code snippet to initialize QCAR and Unity (Vuforia 3.0) in my application:"After much trial and error, I got things working fine with a subview - actually it is a fragment inside an activity which has it's own view. This is in the fragment onCreateView:
mUnityPlayer = new UnityPlayer(getActivity()); final int mode = mUnityPlayer.getSettings().getInt("gles_mode", 1); this.mQCARShared = new QCARPlayerSharedActivity(); this.mQCARShared.onCreate(getActivity(), mode, new QCARPlayerSharedActivity.IUnityInitializer() { @Override public void InitializeUnity() { mUnityPlayer.init(mode, false); FrameLayout container = (FrameLayout)view.findViewById(R.id.unity_container); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); container.addView(mUnityPlayer, 0, lp); mUnityPlayer.windowFocusChanged(true); mUnityPlayer.resume(); } });
Hope this helps you."Since I wanted to integrate the new Object Recognition feature within the application, I made a new Unity project and tried toproceed like in "https://developer.vuforia.com/resources/dev-guide/extending-unity-android-activity-and-adding-custom-views-eclipse" described.
First thing was to change from com.qualcomm.QCARUnityPlayer.QCARPlayerSharedActivity to com.unity3d.player.UnityPlayerNativeActivity.Something like UnityPlayerSharedActivity()
is not existing. Therefore, neither the methods onCreate
nor QCARPlayerSharedActivity.IUnityInitializer()
can be resolved. I can initialize Unity seperately, but I can't get QCAR to initialize.
Do I miss a library or something like that? Or is there another way to initialize QCAR?