juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.15k stars 525 forks source link

Vuforia init error #151

Open davidGM-00 opened 4 years ago

davidGM-00 commented 4 years ago

Hi, I'm working in a flutter + Unity + Vuforia app and when I install the app in my device the unity scene works, but if I come back with the android button the app crash and when I open the app again and I can't start the unity scene because Vuforia can't init, "Vuforia Engine Initialization Error", "Init Error"

tarekBelk commented 4 years ago

Hi there, I had the same error, I could fix it by setting Delayed Initialization in Vuforia setting

Screenshot 2020-06-06 at 15 54 34

and add a script to the camera to initialize it after some delay (for me it works when I put 3 seconds delay)

using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia;

public class VuforiaInit : MonoBehaviour { public Camera ARCamera; int index = 0; private float timeLeft = 0.0f;

void Update()
{
    timeLeft+=Time.deltaTime;
    if (timeLeft>=3.0)
    {
        VuforiaRuntime.Instance.InitVuforia();
        ARCamera.GetComponent<VuforiaBehaviour>().enabled = true;
        print(timeLeft.ToString());
    }
}

}

slimmziy commented 4 years ago

Hello, I'm facing the same problem too here

While i play and build the unity app in the unity, it works fine

But after i export it to my flutter project, when i press the button from my app to open the unity scene, it says : Screenshot_20200618-012550

I tried your delay solution, but not work Any suggestions?

Regards, Slim

juicycleff commented 3 years ago

@davidGM-00 we have not tried against Vuforia sadly

slimmziy commented 3 years ago

The v2 if the widget works like a charm

planetMatrix commented 3 years ago

@juicycleff With the latest release 3.0.1, Vuforia works!

However steps are bit different, check https://github.com/juicycleff/flutter-unity-view-widget/issues/158#issuecomment-739146983

I will document a step by step guide shortly,

Many thanks for this wonderful plugin

With Gratitude

parasshakya commented 3 years ago

Where do I add the script ? @tarekBell

tarekBelk commented 3 years ago

@parasshakya attach the script to the camera

parasshakya commented 3 years ago

Thanks @tarekBelk . It solved the problem for me.

0xhrsh commented 3 years ago

Thanks, @tarekBelk! This worked for me!

dmgcoding commented 2 years ago

@parasshakya attach the script to the camera @tarekBelk what do you mean by this?? which script?