PlayEveryWare / eos_plugin_for_unity

Repository for PlayEveryWare's EOS Plugin for Unity, bringing the functionality of Epic Online Services to the Unity Game Engine.
https://eospluginforunity.playeveryware.com
295 stars 54 forks source link

UnityException: Create can only be called from the main thread. (Android Meta Quest) #1022

Closed tamtahirli closed 2 days ago

tamtahirli commented 5 days ago

Describe the bug In Android (Meta Quest) build, I receive the error below:

image

I do call Init on Awake, as you can see here:

image

I've tried just using EOSManager as well, still same issue.

To Reproduce Steps to reproduce the behavior:

  1. Make Android build
  2. Error, causing EOS not to initialize through EOSManager. Cannot use EOS or Platform tools afterwards.

Expected behavior No error, like in the Editor

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

paomeng-game commented 3 days ago

Well, I also meet this problem when I am in Android Build with Development Build option enabled. Screenshot 2024-11-25 184320 Autoconnected Player "Autoconnected Player" UnityException: Create can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. at UnityEngine.Networking.DownloadHandlerBuffer.InternalCreateBuffer () [0x00003] in \home\bokken\sharedspace\ra_2022.3\Modules\UnityWebRequest\Public\DownloadHandler\DownloadHandler.bindings.cs:223 at UnityEngine.Networking.DownloadHandlerBuffer..ctor () [0x00009] in \home\bokken\sharedspace\ra_2022.3\Modules\UnityWebRequest\Public\DownloadHandler\DownloadHandler.bindings.cs:228 at UnityEngine.Networking.UnityWebRequest.Get (System.String uri) [0x00007] in \home\bokken\sharedspace\ra_2022.3\Modules\UnityWebRequest\Public\WebRequestExtensions.cs:16 at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.ExistsInternal (System.String path, System.Boolean isDirectory) [0x0001e] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Utility\FileSystemUtility.cs:699 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.ExistsInternal (System.String path, System.Boolean isDirectory) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.FileExistsAsync (System.String path) [0x00016] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Utility\FileSystemUtility.cs:692 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.FileExistsAsync (System.String path) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x0001a] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:294 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00020] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:272 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x0006f] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:183 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown ---

at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.FileExistsAsync (System.String path) [0x0006d] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Utility\FileSystemUtility.cs:692 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Utility.FileSystemUtility.FileExistsAsync (System.String path) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x0001a] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:294 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00020] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:272 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x0006f] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:183 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown ---

at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x00074] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:294 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.EnsureConfigFileExistsAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00020] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:272 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x0006f] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:183 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown ---

at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00079] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:272 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.ReadAsync () [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x0006f] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:183 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown ---

at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x000c9] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:183 at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 at PlayEveryWare.EpicOnlineServices.Config.GetAsync[T] () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task1[TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecutionContextCallback (System.Object obj) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <00000000000000000000000000000000>:0 --- End of stack trace from previous location where exception was thrown ---

at PlayEveryWare.EpicOnlineServices.Config.Get[T] () [0x0001a] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Config\Config.cs:201 at PlayEveryWare.EpicOnlineServices.Utility.LogLevelUtility.get_LogLevelList () [0x00004] in .\Library\PackageCache\com.playeveryware.eos@7aeb4560eaf3\Runtime\Core\Utility\LogLevelUtility.cs:50 at PlayEveryWare.EpicOnlineServices.EOSManager+EOSSingleton.InitializeLogLevels () [0x00001] in .\Library\PackageCache\com.play

paulhazen commented 3 days ago

Hi @tamtahirli, we have a fix for this currently in the development branch - although that branch is not as stable as stable or the latest release. If you would like to start making use of the version that's in development we can try and help you get that functional. In the meantime, I will remind myself the exact nature of the fix that we had - and come back here with details so you can implement it yourself if you'd prefer that.

tamtahirli commented 3 days ago

Hi @tamtahirli, we have a fix for this currently in the development branch - although that branch is not as stable as stable or the latest release. If you would like to start making use of the version that's in development we can try and help you get that functional. In the meantime, I will remind myself the exact nature of the fix that we had - and come back here with details so you can implement it yourself if you'd prefer that.

No problem, I've reverted to an old SDK in the meantime so no rush for me.

paulhazen commented 2 days ago

@tamtahirli Excellent. With that in mind, I'm going to mark this issue as closed since it's just a matter of time before the fix becomes live. Feel free to re-open if it becomes more urgent for you - and please reach out if there are any other issues we can help with.