From 96222c6e7d121a5baad2646456748ee6ca31f898 Mon Sep 17 00:00:00 2001 From: Adrien Allard Date: Wed, 11 Oct 2023 10:56:25 +0200 Subject: [PATCH] Fixes: Issue where a freeze on the main thead was occuring in il2cpp when the SteamManager was not at the root of the scene hierachy. --- Assets/Scripts/Steamworks.NET/SteamManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Steamworks.NET/SteamManager.cs b/Assets/Scripts/Steamworks.NET/SteamManager.cs index 3a462c5..cd1d77c 100644 --- a/Assets/Scripts/Steamworks.NET/SteamManager.cs +++ b/Assets/Scripts/Steamworks.NET/SteamManager.cs @@ -76,8 +76,10 @@ protected virtual void Awake() { throw new System.Exception("Tried to Initialize the SteamAPI twice in one session!"); } - // We want our SteamManager Instance to persist across scenes. - DontDestroyOnLoad(gameObject); + if (transform.parent == null) { + // We want our SteamManager Instance to persist across scenes. + DontDestroyOnLoad(gameObject); + } if (!Packsize.Test()) { Debug.LogError("[Steamworks.NET] Packsize Test returned false, the wrong version of Steamworks.NET is being run in this platform.", this);