Unity hard crash on SteamNetworkingUtils.SetConfigValue() since updating to latest
See original GitHub issueWe recently updated to the latest Steamworks.NET from 14.0 and are getting a hard unity crash when calling SteamNetworkingUtils.SetConfigValue()
as such.
float v = 30000f;
System.Runtime.InteropServices.GCHandle floatHandle = System.Runtime.InteropServices.GCHandle.Alloc(v,System.Runtime.InteropServices.GCHandleType.Pinned);
int enabledInt = 1;
System.Runtime.InteropServices.GCHandle enabledIntHandle = System.Runtime.InteropServices.GCHandle.Alloc(enabledInt,System.Runtime.InteropServices.GCHandleType.Pinned);
int dataRate = 150 * 1024;
System.Runtime.InteropServices.GCHandle datarateHandle = System.Runtime.InteropServices.GCHandle.Alloc(dataRate,System.Runtime.InteropServices.GCHandleType.Pinned);
SteamNetworkingUtils.SetConfigValue(ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_TimeoutConnected,ESteamNetworkingConfigScope.k_ESteamNetworkingConfig_Global,System.IntPtr.Zero,ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Float,floatHandle.AddrOfPinnedObject() );
SteamNetworkingUtils.SetConfigValue(ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_IP_AllowWithoutAuth,ESteamNetworkingConfigScope.k_ESteamNetworkingConfig_Global,System.IntPtr.Zero,ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Int32,enabledIntHandle.AddrOfPinnedObject() );
//set datarate limit
SteamNetworkingUtils.SetConfigValue(ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_SendRateMin,ESteamNetworkingConfigScope.k_ESteamNetworkingConfig_Global,System.IntPtr.Zero,ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Int32,datarateHandle.AddrOfPinnedObject() );
SteamNetworkingUtils.SetConfigValue(ESteamNetworkingConfigValue.k_ESteamNetworkingConfig_SendRateMax,ESteamNetworkingConfigScope.k_ESteamNetworkingConfig_Global,System.IntPtr.Zero,ESteamNetworkingConfigDataType.k_ESteamNetworkingConfig_Int32,datarateHandle.AddrOfPinnedObject() );
With the following stack trace from the Editor.log. I’ve attached the full crash logs. Editor.log error.log
0x00007FFA1AF43DFC (steamclient64) Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId 0x00007FFA1AF3ED20 (steamclient64) Breakpad_SteamWriteMiniDumpUsingExceptionInfoWithBuildId 0x000002C16CA9F9D4 (Mono JIT Code) (wrapper managed-to-native) Steamworks.NativeMethods:ISteamNetworkingUtils_SetConfigValue (intptr,Steamworks.ESteamNetworkingConfigValue,Steamworks.ESteamNetworkingConfigScope,intptr,Steamworks.ESteamNetworkingConfigDataType,intptr) 0x000002C16CA9F753 (Mono JIT Code) [C:\Dev\thegreen\TheGreen\Assets\3rd party\Steamworks.NET\autogen\isteamnetworkingutils.cs:321] Steamworks.SteamNetworkingUtils:SetConfigValue (Steamworks.ESteamNetworkingConfigValue,Steamworks.ESteamNetworkingConfigScope,intptr,Steamworks.ESteamNetworkingConfigDataType,intptr) 0x000002C16CA9E6FB (Mono JIT Code) [C:\Dev\thegreen\TheGreen\Assets\Scripts\net\ZSteamSocket.cs:138] ZSteamSocket:RegisterGlobalCallbacks () 0x000002C16CA9E023 (Mono JIT Code) [C:\Dev\thegreen\TheGreen\Assets\Scripts\net\ZSteamSocket.cs:23] ZSteamSocket:.ctor () 0x000002C16CA8A4E3 (Mono JIT Code) [C:\Dev\thegreen\TheGreen\Assets\Scripts\net\ZNet.cs:195] ZNet:Awake () 0x000002C1788E6B48 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007FFA1EA8E280 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2813] mono_jit_runtime_invoke 0x00007FFA1EA12AE2 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke 0x00007FFA1EA1BB3F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke 0x00007FF7D0A53F3E (Unity) scripting_method_invoke 0x00007FF7D0A4D98D (Unity) ScriptingInvocation::Invoke 0x00007FF7D0A4DC5E (Unity) ScriptingInvocation::InvokeChecked 0x00007FF7D0AB5716 (Unity) SerializableManagedRef::CallMethod 0x00007FF7D0A1050D (Unity) MonoBehaviour::CallAwake 0x00007FF7D0A0EEEF (Unity) MonoBehaviour::AddToManager 0x00007FF7D0A0F93C (Unity) MonoBehaviour::AwakeFromLoad 0x00007FF7CF0CDDD6 (Unity) AwakeFromLoadQueue::InvokePersistentManagerAwake 0x00007FF7CF0CE8A0 (Unity) AwakeFromLoadQueue::PersistentManagerAwakeFromLoad 0x00007FF7D0504553 (Unity) LoadSceneOperation::CompleteAwakeSequence 0x00007FF7D05047F0 (Unity) LoadSceneOperation::CompletePreloadManagerLoadSceneEditor 0x00007FF7D05054A9 (Unity) LoadSceneOperation::IntegrateMainThread 0x00007FF7D0508D49 (Unity) PreloadManager::UpdatePreloadingSingleStep 0x00007FF7D050952F (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete 0x00007FF7CED71838 (Unity) EditorSceneManager::RestoreSceneBackups 0x00007FF7CE7B8774 (Unity) PlayerLoopController::EnterPlayMode 0x00007FF7CE7CAF45 (Unity) PlayerLoopController::SetIsPlaying 0x00007FF7CE7CDC32 (Unity) Application::TickTimer 0x00007FF7CF16B5B5 (Unity) MainMessageLoop 0x00007FF7CF1757C8 (Unity) WinMain 0x00007FF7D2269472 (Unity) __scrt_common_main_seh 0x00007FFAC2737034 (KERNEL32) BaseThreadInitThunk 0x00007FFAC2FE2651 (ntdll) RtlUserThreadStart
This worked fine before the update. Has anything been changed recently that can be causing this and are there any tips on how to get this working again?
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
I’m pretty sure I cleared up the old dirs and cleared all temp files, but not sure where any old DLL’s might be hanging around?
Steam can initialize though, and IsRunningOnSteamDeck() does return a value, so everything else we are using seems to be working up until the point we try to create a server, it’s when an actual server is started and those lines of code are run that unity itself hard crashed (or the build game exe).
Small addition to this. For steam socket networking options, it is better to set these option on creating connection rather than calling
SteamNetworkingUtils.SetConfigValue
later as quoted from Steam DOCFor example
in network connection creation, last 2 arguments. Let
SteamNetworkingConfigValue_t[] options
Client -SteamNetworkingSockets.ConnectP2P( networkIdentity, virtualPort, options.Length, options )
Server -SteamNetworkingSockets.CreateListenSocketP2P( virtualPort, options.Length, options )
Example on one of the popular network option
k_ESteamNetworkingConfig_SendBufferSize
This one is associate tok_EResultLimitExceeded
error which happen when too much data to push to network and famously on Valhiem community.