Categories
Unity wit.ai

Wit.Ai fallback for activation error

I’m working on a project that uses wit.ai, and in a few playtests, it randomly wouldn’t activate. There might’ve been phone connection issues, but it prevented the project from moving forward because it was waiting for a response.

I couldn’t really find info on how to resolve that, but after some playing around this is what I came up with. I call the Activation, and then I check afterwards to see if it’s been activated. If it hasn’t, then I tell the timeline to resume.

 voiceExperience.Activate();
        //check to see if wit.ai actually activated. If it didn't, then do something else
        if (!voiceExperience.Active)
        {
        //do something here
        }