Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Google Credentials environment variable Oculus Quest

Discussion in 'Scripting' started by Blomios38, May 15, 2020.

  1. Blomios38

    Blomios38

    Joined:
    Feb 3, 2020
    Posts:
    1
    Hi ! I'm currently working on Oculus Quest with Unity 2019.3.11. I would like to implement Speech reco from Google Cloud. For it, it is necessary to link JSON file to GOOGLE_APPLICATION_CREDENTIALS environment variable.
    This is my current code to create my client :

    Code (CSharp):
    1.  
    2. string full_path = string.Format("{0}/{1}", Application.streamingAssetsPath, "gcpcredentials.json");
    3. WWW reader = new WWW(full_path);
    4. while (!reader.isDone) { }
    5.  
    6. string json = reader.text;
    7.  
    8. var credential = GoogleCredential.FromJson(json);
    9. var channel = new Grpc.Core.Channel(SpeechClient.DefaultEndpoint.ToString(), credential.ToChannelCredentials());
    10.  
    11.  SpeechClient speech = SpeechClient.Create(channel);
    12.  
    The following errors are throw :

    System.InvalidOperationException: Error deserializing JSON credential data. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.

    05-15 14:41:20.275 23690 23704 I Unity : at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDynamicMethod (System.String name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) [0x00018] in <07e3893119a945b29a35e81930b1c8ad>:0

    05-15 14:41:20.275 23690 23704 I Unity : at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateDefaultConstructor[T] (System.Type type) [0x00010] in <07e3893119a945b29a35e81930b1c8ad>:0

    05-15 14:41:20.275 23690 23704 I Unity : at Newtonsoft.Json.Serialization.DefaultContractResolver.GetDefaultCreator (System.Type createdType) [0x00005] in <07e3893119a945b29a35e81930b1c8ad>:0

    05-15 14:41:20.275 23690 23704 I Unity : at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00093] in <07e3893119a945b29a35e81930b1c8ad>:0

    05-15 14:41:20.275 23690 23704 I Unity : at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [0x00007] in <07

    Does oculus quest is not compatible with Google Cloud API ? Or there is an other way to set environment variables ?

    Thanks !
     
  2. GumiDev

    GumiDev

    Joined:
    Feb 28, 2020
    Posts:
    3
    Hi I am having same problem and don't know how to fix,could you shared your solution .Thank you in advance
     
  3. JeremieB5

    JeremieB5

    Joined:
    Nov 30, 2016
    Posts:
    4
    Hi there ! Did you find any solution ? I try to use Google Speech too with Oculus Quest and IL2CPP backend scripting but couldn't make it work.