Skip to content

[BUG]: UnityException: ValidateAgainstExecutionFlags can only be called from the main thread. #903

@stonerey

Description

@stonerey

Package version

3.1.0-exp.2

Environment

* OS:Windows
* Unity version:Unity2021.3.2f1
* Graphics API:DirectX11
* Browser:Google Chrome Version 113.0.5672.93

Steps To Reproduce

1.built to .exe then excute.
2.This problem occurs when the web client accesses the Multiplay Sample, connects to it, exits from it, and connects to it again for 3 to 5 times,then .exe crash!!!
3.The log information is as follows:
UnityException: ValidateAgainstExecutionFlags 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.Rendering.CommandBuffer.ValidateAgainstExecutionFlags (UnityEngine.Rendering.CommandBufferExecutionFlags requiredFlags, UnityEngine.Rendering.CommandBufferExecutionFlags invalidFlags) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Rendering.CommandBuffer.IssuePluginEventAndData (System.IntPtr callback, System.Int32 eventID, System.IntPtr data) [0x00000] in <00000000000000000000000000000000>:0
at Unity.WebRTC.VideoEncoderMethods.FinalizeEncoder (System.IntPtr callback, System.IntPtr track) [0x00000] in <00000000000000000000000000000000>:0
at Unity.WebRTC.VideoStreamTrack.Dispose () [0x00000] in <00000000000000000000000000000000>:0
at Unity.WebRTC.MediaStreamTrack.Finalize () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.<>c:b__0_0(Object, UnhandledExceptionEventArgs)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)

Current Behavior

No response

Expected Behavior

No response

Anything else?

log.txt
error

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions