IBM Text-To-Speech is not working in Unity [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I followed a tutorial to use text to speech with IBM Watson Assistant in Unity 2019.4.9f1. The problem is doesn't translated the text into speech, I did a few logging to see if it received the result from Assistant and it did but it's not turning into speech. I'm new to working with Unity and IBM Watson so I don't understand what's the problem. I tried looking up the error online but I can't find any solution to it. Any help would be greatly appreciated.
3 errors that show up in my console are these:
[09/10/2020 20:44:58][RESTConnector.ProcessRequestQueue()][ERROR] URL: https://api.eu-gb.text-to-speech.watson.cloud.ibm.com/v1/synthesize?voice=en-GB_KateVoice, ErrorCode: 400, Error: HTTP/1.1 400 Bad Request, Response: {
"error": "Input contains unmatched open SSML tags",
"code": 400,
"code_description": "Bad Request"
}
UnityEngine.Debug:LogError(Object)
IBM.Cloud.SDK.Debug.DebugReactor:ProcessLog(LogRecord) (at Assets/IBMSDKCore/Debug/DebugReactor.cs:60)
IBM.Cloud.SDK.LogSystem:ProcessLog(LogRecord) (at Assets/IBMSDKCore/Logging/Logger.cs:207)
IBM.Cloud.SDK.Log:Error(String, String, Object[]) (at Assets/IBMSDKCore/Logging/Logger.cs:280)
IBM.Cloud.SDK.Connection.d__33:MoveNext() (at Assets/IBMSDKCore/Connection/RESTConnector.cs:606)
IBM.Cloud.SDK.Utilities.Routine:MoveNext() (at Assets/IBMSDKCore/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[09/10/2020 20:44:58][Unity][CRITICAL] Unity Exception ArgumentNullException: Buffer cannot be null.
Parameter name: buffer : System.IO.MemoryStream..ctor (System.Byte[] buffer, System.Boolean writable) (at :0)
(wrapper remoting-invoke-with-check) System.IO.MemoryStream..ctor(byte[],bool)
IBM.Cloud.SDK.Utilities.WaveFile.ParseWAV (System.String clipName, System.Byte[] data) (at Assets/IBMSDKCore/Utilities/WaveFile.cs:115)
TextToSpeech+<>c__DisplayClass18_0.b__0 (IBM.Cloud.SDK.DetailedResponse`1[T] response, IBM.Cloud.SDK.IBMError error) (at Assets/Script/TextToSpeech.cs:218)
IBM.Watson.TextToSpeech.V1.TextToSpeechService.OnSynthesizeResponse (IBM.Cloud.SDK.Connection.RESTConnector+Request req, IBM.Cloud.SDK.Connection.RESTConnector+Response resp) (at Assets/Watson/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs:357)
IBM.Cloud.SDK.Connection.RESTConnector+d__33.MoveNext () (at Assets/IBMSDKCore/Connection/RESTConnector.cs:646)
IBM.Cloud.SDK.Utilities.Runnable+Routine.MoveNext () (at Assets/IBMSDKCore/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)
UnityEngine.Debug:LogError(Object)
IBM.Cloud.SDK.Debug.DebugReactor:ProcessLog(LogRecord) (at Assets/IBMSDKCore/Debug/DebugReactor.cs:60)
IBM.Cloud.SDK.LogSystem:ProcessLog(LogRecord) (at Assets/IBMSDKCore/Logging/Logger.cs:207)
IBM.Cloud.SDK.Log:Critical(String, String, Object[]) (at Assets/IBMSDKCore/Logging/Logger.cs:295)
IBM.Cloud.SDK.LogSystem:UnityLogCallback(String, String, LogType) (at Assets/IBMSDKCore/Logging/Logger.cs:168)
UnityEngine.Application:CallLogCallback(String, String, LogType, Boolean)
ArgumentNullException: Buffer cannot be null.
Parameter name: buffer
System.IO.MemoryStream..ctor (System.Byte[] buffer, System.Boolean writable) (at :0)
(wrapper remoting-invoke-with-check) System.IO.MemoryStream..ctor(byte[],bool)
IBM.Cloud.SDK.Utilities.WaveFile.ParseWAV (System.String clipName, System.Byte[] data) (at Assets/IBMSDKCore/Utilities/WaveFile.cs:115)
TextToSpeech+<>c__DisplayClass18_0.b__0 (IBM.Cloud.SDK.DetailedResponse`1[T] response, IBM.Cloud.SDK.IBMError error) (at Assets/Script/TextToSpeech.cs:218)
IBM.Watson.TextToSpeech.V1.TextToSpeechService.OnSynthesizeResponse (IBM.Cloud.SDK.Connection.RESTConnector+Request req, IBM.Cloud.SDK.Connection.RESTConnector+Response resp) (at Assets/Watson/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs:357)
IBM.Cloud.SDK.Connection.RESTConnector+d__33.MoveNext () (at Assets/IBMSDKCore/Connection/RESTConnector.cs:646)
IBM.Cloud.SDK.Utilities.Runnable+Routine.MoveNext () (at Assets/IBMSDKCore/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)

If you have fixed/ non changing lines you want to be translated into speech the best thing to do is to make them into an audio file and then import them into unity.
what you could also do is do the speech yourself and import it.
this is also helpful because then you can trigger the audio on a collision with other objects/points. for example in a tutorial level.
the other solution is to check your console i see 3 Errors and the rest just looks like warnings if you fix the errors the warnings will go away.
the first one looks like you have a bad request to the server, try another sml tag and check if it works.
the second and third one is the buffer, that should be configured in the code. so if you fix that you fix all the problems!

Related

Pointer Error when using GGVPointer on MRTK canvas Unity

I am attempting to build a world space canvas that is useable with the Hololens 2 in Unity. Whenever I activate the pointer hand I am receiving this error:
The pointer you are trying to remove does not exist in the mapping dict!
MixedRealityInputModule.cs
I have spent several hours fiddling with the input profiles and searching the web to no avail. If you have experienced this issue or have any idea of what is causing this please let me know. Thanks for your time.
p.s stack trace is posted below:
The pointer you are trying to remove does not exist in the mapping dict!
UnityEngine.Debug:LogError (object)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputModule:Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler.OnSourceLost (Microsoft.MixedReality.Toolkit.Input.SourceStateEventData) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputModule.cs:433)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem/<>c:<.cctor>b__246_1 (Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler,UnityEngine.EventSystems.BaseEventData) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputSystem.cs:970)
UnityEngine.EventSystems.ExecuteEvents:ExecuteHierarchy<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler> (UnityEngine.GameObject,UnityEngine.EventSystems.BaseEventData,UnityEngine.EventSystems.ExecuteEvents/EventFunction1<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler>) Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:DispatchEventToObjectFocusedByPointer<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler> (Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer,Microsoft.MixedReality.Toolkit.Input.BaseInputEventData,bool,UnityEngine.EventSystems.ExecuteEvents/EventFunction1<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler>) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputSystem.cs:703)
Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:HandleEvent<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler> (UnityEngine.EventSystems.BaseEventData,UnityEngine.EventSystems.ExecuteEvents/EventFunction1<Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler>) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputSystem.cs:471) Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:RaiseSourceLost (Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource,Microsoft.MixedReality.Toolkit.Input.IMixedRealityController) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputSystem.cs:960) Microsoft.MixedReality.Toolkit.Input.BaseInputSimulationService:RemoveControllerDevice (Microsoft.MixedReality.Toolkit.Utilities.Handedness) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Providers/InputSimulation/BaseInputSimulationService.cs:178) Microsoft.MixedReality.Toolkit.Input.BaseInputSimulationService:UpdateControllerDevice (Microsoft.MixedReality.Toolkit.Input.ControllerSimulationMode,Microsoft.MixedReality.Toolkit.Utilities.Handedness,object) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Providers/InputSimulation/BaseInputSimulationService.cs:88) Microsoft.MixedReality.Toolkit.Input.InputSimulationService:LateUpdate () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Providers/InputSimulation/InputSimulationService.cs:390) Microsoft.MixedReality.Toolkit.BaseDataProviderAccessCoreSystem:LateUpdate () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Services/BaseDataProviderAccessCoreSystem.cs:67) Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem:LateUpdate () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Services/InputSystem/MixedRealityInputSystem.cs:273) Microsoft.MixedReality.Toolkit.MixedRealityToolkit/<>c:<LateUpdateAllServices>b__74_0 (Microsoft.MixedReality.Toolkit.IMixedRealityService) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Services/MixedRealityToolkit.cs:1074) Microsoft.MixedReality.Toolkit.MixedRealityToolkit:ExecuteOnAllServicesInOrder (System.Action1<Microsoft.MixedReality.Toolkit.IMixedRealityService>) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Services/MixedRealityToolkit.cs:1148)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:LateUpdateAllServices () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Services/MixedRealityToolkit.cs:1074)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit:LateUpdate () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation#251fc689f36f/Core/Services/MixedRealityToolkit.cs:738)

IBM Watson Unity 3D Text to Speech not working

I just started working on Watson speech to text recognition in Unity 2018.3.14f1. The problem is I can't get it to work whenever I run it, it runs but doesn't catch my voice and throws an exception that "Access token not present in response". I am new to this so I don't really understand what the error actually is. In my console I have a total of 4 errors
[08/26/2019 12:01:06][RESTConnector.ProcessRequestQueue()][ERROR] URL:
https://iam.cloud.ibm.com/identity/token, ErrorCode: 400, Error:
HTTP/1.1 400 Bad Request, Response:
{"context":{"requestId":"cb016290a97a4c569c66c8c54e8c5ae2","requestType":"incoming.Identity_Token","userAgent":"UnityPlayer/2018.3.14f1
(UnityWebRequest/1.0,
libcurl/7.52.0-DEV)","clientIp":"196.62.166.231","url":"https://iam.cloud.ibm.com","instanceId":"iamid-4.3-6319-2d7e1b8-76674d8789-7rpds","threadId":"137ffe","host":"iamid-4.3-6319-2d7e1b8-76674d8789-7rpds","startTime":"26.08.2019
12:09:00:571 UTC","endTime":"26.08.2019 12:09:00:628
UTC","elapsedTime":"57","locale":"en_US","clusterName":"iam-id-prlon04-6r67"},"errorCode":"BXNIM0415E","errorMessage":"Provided
API key could not be found"} UnityEngine.Debug:LogError(Object)
IBM.Cloud.SDK.Debug.DebugReactor:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Debug/DebugReactor.cs:60)
IBM.Cloud.SDK.LogSystem:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:207)
IBM.Cloud.SDK.Log:Error(String, String, Object[]) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:280)
IBM.Cloud.SDK.Connection.d__31:MoveNext() (at
Assets/unity-sdk-core-0.3.0/Connection/RESTConnector.cs:593)
IBM.Cloud.SDK.Utilities.Routine:MoveNext() (at
Assets/unity-sdk-core-0.3.0/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[08/26/2019 12:01:06][Credentials.OnRequestIamTokenResponse()][ERROR]
Exception: System.ArgumentNullException: Array cannot be null.
Parameter name: bytes at System.Text.Encoding.GetString
(System.Byte[] bytes) [0x00012] in :0 at
IBM.Cloud.SDK.Authentication.IamTokenManager.OnRequestIamTokenResponse
(IBM.Cloud.SDK.Connection.RESTConnector+Request req,
IBM.Cloud.SDK.Connection.RESTConnector+Response resp) [0x0006e] in
C:\Users\owais\OneDrive\Desktop\Owais\Programming\Unity\AR Google
Images\Assets\unity-sdk-core-0.3.0\Authentication\IamTokenManager.cs:140
UnityEngine.Debug:LogError(Object)
IBM.Cloud.SDK.Debug.DebugReactor:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Debug/DebugReactor.cs:60)
IBM.Cloud.SDK.LogSystem:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:207)
IBM.Cloud.SDK.Log:Error(String, String, Object[]) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:280)
IBM.Cloud.SDK.Authentication.IamTokenManager:OnRequestIamTokenResponse(Request,
Response) (at
Assets/unity-sdk-core-0.3.0/Authentication/IamTokenManager.cs:146)
IBM.Cloud.SDK.Connection.d__31:MoveNext() (at
Assets/unity-sdk-core-0.3.0/Connection/RESTConnector.cs:633)
IBM.Cloud.SDK.Utilities.Routine:MoveNext() (at
Assets/unity-sdk-core-0.3.0/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
3.[08/26/2019 12:01:06][Unity][CRITICAL] Unity Exception Exception:
Access token not present in response :
IBM.Cloud.SDK.Authentication.JwtTokenManager.SaveTokenInfo
(IBM.Cloud.SDK.Authentication.TokenData tokenResponse) (at
Assets/unity-sdk-core-0.3.0/Authentication/JwtTokenManager.cs:169)
IBM.Cloud.SDK.Authentication.JwtTokenManager.OnGetToken
(IBM.Cloud.SDK.DetailedResponse`1[T] response, IBM.Cloud.SDK.IBMError
error) (at
Assets/unity-sdk-core-0.3.0/Authentication/JwtTokenManager.cs:106)
IBM.Cloud.SDK.Authentication.IamTokenManager.OnRequestIamTokenResponse
(IBM.Cloud.SDK.Connection.RESTConnector+Request req,
IBM.Cloud.SDK.Connection.RESTConnector+Response resp) (at
Assets/unity-sdk-core-0.3.0/Authentication/IamTokenManager.cs:151)
IBM.Cloud.SDK.Connection.RESTConnector+d__31.MoveNext () (at
Assets/unity-sdk-core-0.3.0/Connection/RESTConnector.cs:633)
IBM.Cloud.SDK.Utilities.Runnable+Routine.MoveNext () (at
Assets/unity-sdk-core-0.3.0/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext
(System.Collections.IEnumerator enumerator, System.IntPtr
returnValueAddress) (at
C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.Debug:LogError(Object)
IBM.Cloud.SDK.Debug.DebugReactor:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Debug/DebugReactor.cs:60)
IBM.Cloud.SDK.LogSystem:ProcessLog(LogRecord) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:207)
IBM.Cloud.SDK.Log:Critical(String, String, Object[]) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:295)
IBM.Cloud.SDK.LogSystem:UnityLogCallback(String, String, LogType) (at
Assets/unity-sdk-core-0.3.0/Logging/Logger.cs:168)
UnityEngine.Application:CallLogCallback(String, String, LogType,
Boolean)
Exception:
Access token not present in response
IBM.Cloud.SDK.Authentication.JwtTokenManager.SaveTokenInfo
(IBM.Cloud.SDK.Authentication.TokenData tokenResponse) (at
Assets/unity-sdk-core-0.3.0/Authentication/JwtTokenManager.cs:169)
IBM.Cloud.SDK.Authentication.JwtTokenManager.OnGetToken
(IBM.Cloud.SDK.DetailedResponse`1[T] response, IBM.Cloud.SDK.IBMError
error) (at
Assets/unity-sdk-core-0.3.0/Authentication/JwtTokenManager.cs:106)
IBM.Cloud.SDK.Authentication.IamTokenManager.OnRequestIamTokenResponse
(IBM.Cloud.SDK.Connection.RESTConnector+Request req,
IBM.Cloud.SDK.Connection.RESTConnector+Response resp) (at
Assets/unity-sdk-core-0.3.0/Authentication/IamTokenManager.cs:151)
IBM.Cloud.SDK.Connection.RESTConnector+d__31.MoveNext () (at
Assets/unity-sdk-core-0.3.0/Connection/RESTConnector.cs:633)
IBM.Cloud.SDK.Utilities.Runnable+Routine.MoveNext () (at
Assets/unity-sdk-core-0.3.0/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext
(System.Collections.IEnumerator enumerator, System.IntPtr
returnValueAddress) (at
C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
Please can anyone help? Much appreciated..

Failed to update Android SDK package list

Everytime I try to open the Player settings, it will show only blank. And the error below will be shown in the console.
I have tried to follow this link: https://answers.unity.com/questions/1320634/unable-to-list-target-platforms-when-i-try-to-buil.html
But still didn't work.
CommandInvokationFailure: Failed to update Android SDK package list.
/Applications/Unity/Hub/Editor/2019.2.0b1/PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager --list
stderr[
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 4 more
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.SDKManager.UpdatePackagesList () (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.SDKManager.HighestVersionInstalled (UnityEditor.Android.SDKManager+Component tool) (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.AndroidPlatformIconProvider.GetCurrentSetAndroidSDKVersion () (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.AndroidPlatformIconProvider.UpdateSDKVersion () (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.AndroidPlatformIconProvider.get_targetSDKSupportsAdaptiveIcons () (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.Android.PlayerSettingsEditorExtension.IconSectionGUI () (at <4e05d4950c734693b0d63f05223d7a90>:0)
UnityEditor.PlayerSettingsEditor.IconSectionGUI (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.Modules.ISettingEditorExtension settingsExtension, System.Int32 sectionIndex) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:803)
UnityEditor.PlayerSettingsEditor.OnInspectorGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs:573)
UnityEditor.AssetSettingsProvider.OnGUI (System.String searchContext) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/Providers/AssetSettingsProvider.cs:94)
UnityEditor.SettingsWindow.DrawControls () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:322)
UnityEditor.SettingsWindow.DrawSettingsPanel () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Settings/SettingsWindow.cs:313)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Before, I can see some options so that I can try to build.
I was having this issue as well. Nothing worked until I did this:
Go Unity > Preferences, select External Tools, deselect everything
Close the Editor
Open the Editor, re-enable everything you deselected
Hit Play to force a refresh
Then build again and it'll work
I got the same error and fixed it in a different way.
Possible fix here Failed to update Android SDK Package List
I got the same error after importing the firebase SDK into Unity 2021.3.3f1. It turned out my system variable JAVA_HOME was not pointing to the Java used by Unity (which apparantly only caused a problem in combination with firebase).
To solve it I had to
change Windows 10 -> Settings -> System -> Edit System variables
Change the value of "JAVA_HOME" to my Unity Java version: "F:\Programs\Unity\2021.3.3f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK"
Reboot my Computer (for the JAVA_HOME change to take effect)
In Unity: Click on Assets -> External Dependency Manager -> Android -> Resolve
Not sure if the last step was necessary. I tried a lot of things (including "regenerating project files" - from Unitys settings)

Unity Watson SDK error on Speech to Text Example

I'm trying to run the newest Unity Watson SDK from GitHub. Whenever I try to play the example scene for speech to text, I get this error. I have the API key set and my region is US-Dallas, but I don't think it's related to the problem.
I'm building an app for Android that utilizes speech to text. I've tried looking this up for hours, but I can't find a solution. I've tried re-downloading the SDK but nothing changed.
[02/03/2019 00:54:42][Unity][CRITICAL] Unity Exception
ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length : System.String.Substring (System.Int32
startIndex, System.Int32 length) (at
<f2e6809acb14476a81f399aeb800f8f2>:0)
IBM.Watson.DeveloperCloud.Connection.RESTConnector.AddHeaders
(System.Collections.Generic.Dictionary`2[TKey,TValue] headers)
(at Assets/unity-sdk-
2.14.0/Scripts/Connection/RESTConnector.cs:380)
IBM.Watson.DeveloperCloud.Connection.RESTConnector+
<ProcessRequestQueue>c__Iterator0.MoveNext () (at Assets/unity-sdk-
2.14.0/Scripts/Connection/RESTConnector.cs:470)
IBM.Watson.DeveloperCloud.Utilities.Runnable+Routine.MoveNext ()
(at Assets/unity-sdk-2.14.0/Scripts/Utilities/Runnable.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext
(System.Collections.IEnumerator enumerator, System.IntPtr
returnValueAddress)
(at
/Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.Debug:LogError(Object)
IBM.Watson.DeveloperCloud.Debug.DebugReactor:ProcessLog(LogRecord)
(at Assets/unity-sdk-2.14.0/Scripts/Debug/DebugReactor.cs:60)
IBM.Watson.DeveloperCloud.Logging.LogSystem:ProcessLog(LogRecord)
(at Assets/unity-sdk-2.14.0/Scripts/Logging/Logger.cs:206)
IBM.Watson.DeveloperCloud.Logging.Log:Critical(String, String,
Object[]) (at Assets/unity-sdk-2.14.0/Scripts/Logging/Logger.cs:294)
IBM.Watson.DeveloperCloud.Logging.LogSystem:UnityLogCallback(String,
String, LogType) (at Assets/unity-sdk-
2.14.0/Scripts/Logging/Logger.cs:167)
UnityEngine.Application:CallLogCallback(String, String, LogType,
Boolean)
I know the scene is supposed to output what it thinks I am saying, but nothing is happening. Any help would be appreciated!

Unity Failed to Build apk Android

i followed the unity "tanks!" tutorial and now i'm trying to port the game on Android, it's my first time on Unity, now when it's going to build the APK unity tells me "Failed To Build APK" and then i get some errors, i'm attaching you the error i think it's fatal, please tell me what's wrong with it.
CommandInvokationFailure: Failed to build apk.
C:/Program Files/Java/jdk-9.0.1\bin\java.exe -Xmx2048M -D com.android.sdkmanager.toolsdir="C:/Android_SDK\tools" -D file.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar"-
stderr[
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at SDKMain.main(SDKMain.java:130)
Caused by: java.lang.NoClassDefFoundError: sun/misc/BASE64Encoder
at com.android.sdklib.internal.build.SignedJarBuilder.<init>(SignedJarBuilder.java:177)
at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:422)
at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:362)
at UnityApkBuilder.<init>(UnityApkBuilder.java:214)
at UnityApkBuilder.main(UnityApkBuilder.java:34)
... 5 more
Caused by: java.lang.ClassNotFoundException: sun.misc.BASE64Encoder
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 11 more
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run(System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 emoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 emoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
If you execute jdeps on your application, you would be able to see that sun.misc.BASE64Encoder has been deprecated and can be replaced with java.util.Base64 which is there since JDK 1.8.
The migration guide reads this as well :
A few sun.* APIs have been removed in JDK 9. Notably,
sun.misc.BASE64Encoder and sun.misc.BASE64Decoder have been removed.
Instead, use the supported java.util.Base64 class, which was added in
Java SE 8.
In your case, since you rely on third parties(android sdktools) which themselves haven't resolved this. I'm afraid you might have to stick with 1.8 and in the meanwhile, this can be reported to their trackers once they plan to migrate their artifacts.
Of course, this also means you would have to at some point in time upgrade to using their Java 9 compatible version of the jar if and when they plan to release.
Update : This can be tracked on Unity#956425 for further updates.

Categories