You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In standalone Unity IL2CPP builds on Windows, about 1 in 10 times Steam initialization will fail with a message similar to:
Exception: SteamApi_Init failed with VersionMismatch - error: No ����������G����
Apparently the Steam library is returning an error message string containing garbage bytes from adjacent memory, indicating that it's not constructing the string correctly or failing to properly null-terminate it.
This issue is similar to the bug reported for SteamDeck here, however what we are seeing is intermittent and not happening consistently. Also the other issue mentioned Steam initialization working as expected on Windows, which is not what we're experiencing.
We're using the latest Facepunch release 2.4.1 with Steamworks 1.61.
To Reproduce
Steps to reproduce the behavior:
Create a blank Unity project and open it for the default Windows build target
Add the Facepunch Steamworks plugin for Unity to the project, underneath the Assets/Plugins directory
Add a new script to the SampleScene containing the following code:
using System;
using Steamworks;
using UnityEngine;
public class SteamTest : MonoBehaviour
{
public uint appId;
void Start()
{
try
{
Debug.Log("Initializing Steam client...");
SteamClient.Init(appId, asyncCallbacks: true);
Debug.LogError("Steam successfully initialized!"); // Logging as error to get some visual feedback
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
private void OnDestroy()
{
Debug.Log("Shutting down Steam client...");
SteamClient.Shutdown();
}
}
Enter an existing Steam App ID on the script component in the scene, and save the scene
In the project's Player Settings -> Other Settings, set Scripting Backend to IL2CPP
In File -> Build Profiles, select the Windows build target and enable Development Build and Script Debugging
Create a Windows build with the SampleScene included
Run the standalone build several times and observe that sometimes an exception will be logged
Calling Code
SteamClient.Init(appId, asyncCallbacks: true);
Expected behavior
Steam initialization should succeed and behave consistently between application runs.
Desktop (please complete the following information):
OS: Windows 10
Unity: Unity 6000.0.34f1
Additional context
The intermittent nature as well as the memory corruption leads me to believe this may be some kind of race condition.
Other things I've tried:
Created a standalone C++ console application that compiles directly against the Steamworks SDK which replicates the initialization steps from Facepunch. I have not been able to reproduce the error with this.
Created a standalone C# console application that uses P/Invoke to initialize Steamworks, similar to how Facepunch does this. I have not been able to reproduce the error with this.
Included Facepunch Steamworks as source code in our Unity project instead of using the precompiled DLLs. The issue is still reproducible with this.
Rebuilt my Unity test project using the Mono scripting backend. With this I have not been able to reproduce the error.
So it appears that this problem is unique to Unity's interaction with the Steamworks native library, specifically when using the IL2CPP scripting backend.
The text was updated successfully, but these errors were encountered:
Describe the bug
In standalone Unity IL2CPP builds on Windows, about 1 in 10 times Steam initialization will fail with a message similar to:
Exception: SteamApi_Init failed with VersionMismatch - error: No ����������G����
Apparently the Steam library is returning an error message string containing garbage bytes from adjacent memory, indicating that it's not constructing the string correctly or failing to properly null-terminate it.
This issue is similar to the bug reported for SteamDeck here, however what we are seeing is intermittent and not happening consistently. Also the other issue mentioned Steam initialization working as expected on Windows, which is not what we're experiencing.
We're using the latest Facepunch release 2.4.1 with Steamworks 1.61.
To Reproduce
Steps to reproduce the behavior:
Calling Code
Expected behavior
Steam initialization should succeed and behave consistently between application runs.
Desktop (please complete the following information):
Additional context
The intermittent nature as well as the memory corruption leads me to believe this may be some kind of race condition.
Other things I've tried:
So it appears that this problem is unique to Unity's interaction with the Steamworks native library, specifically when using the IL2CPP scripting backend.
The text was updated successfully, but these errors were encountered: