Facepunch / Facepunch.Steamworks

Another fucking c# Steamworks implementation
MIT License
2.85k stars 344 forks source link

(Kinda Solved) SteamClient.Init causes editor to hang and become frozen. Not build. #611

Open Sonicboomcolt opened 2 years ago

Sonicboomcolt commented 2 years ago

Bug Calling SteamClient.Init with latest Release of Facepunch.Steamworks, will cause the engine to hang and go into a not responding state.

This currently is happing after Steam did an update on Nov-23-2021. Everything worked fine before the update. Game still loads fine as build.

Code

 SteamClient.Init(123456, asyncCallbacks: true);

Extra OS: Windows 10 Unity version: 2020.3.13f1 Steamworks version: 2.3.2

This seems to only be when Steam does the init as if I don't call that line the editor works just fine.

Sonicboomcolt commented 2 years ago

Found the issue!

Info Some how the line of code calling ach.GetIconAsync(); and LoadRawTextureData(image.Result.Value.Data, image.Result.Value.Width, image.Result.Value.Height);, was causing the engine to hang. I could be possible that this issue was my fault, but would be nice to know why it happens when Steam updated.

Code

var image = ach.GetIconAsync();

achivementObject.transform.GetChild(0).GetComponent<RawImage>().texture = LoadRawTextureData(image.Result.Value.Data, image.Result.Value.Width, image.Result.Value.Height);

public Texture LoadRawTextureData(byte[] data, uint width, uint height)
 {
      Texture2D tex = new Texture2D(checked((int)width), checked((int)height), TextureFormat.RGBA32, false);
      tex.LoadRawTextureData(data);
      tex.Apply();

      return tex;
}