Steamworks.NET icon indicating copy to clipboard operation
Steamworks.NET copied to clipboard

Issue with Callbacks begin called 1 extra time each time a scene is reloaded.

Open GrantHallDevelopment opened this issue 3 years ago • 2 comments

Hi there,

I'm having an issue regarding Steamworks latest Unity build. Currently I'm having an issue where if I Create a callback in the start method. For instance, I'm creating a lobby system. So I will Create the lobby and host after pressing a button. I host and run SteamMatchmaking.CreateLobby and the first time this script is active. it's all fine. In the callback for OnLobbyCreated. It's called once. If I refresh the scene or change scene and go back. It calls it twice. Then again thrice, and so forth.

In the video I'm pressing the R key just to reload the same scene and it's creating a stacking effect of callbacks for some reason. I've tried Disposing of them during Ondisable and Destroy and likewise for Unregister. But none of that works

It's almost as if the disposal of the callbacks isn't happening when the scene changes or anything, that the callbacks it make don't disappear, and it creates new ones on top of the existing ones.

p.s The scripts shown are not singletons or have any don't destroy on loads on them. They are single instances held within the scene you'll see on the video.

Unity Version 2021.3.4f1

Jordan

https://user-images.githubusercontent.com/84627320/175438175-bbbb29b6-6078-49d9-99a6-6e51a49db0a3.mp4 image image

GrantHallDevelopment avatar Jun 24 '22 00:06 GrantHallDevelopment

https://user-images.githubusercontent.com/84627320/175438408-6981e0dc-f6db-4a42-a585-e69ba0626d17.mp4

GrantHallDevelopment avatar Jun 24 '22 00:06 GrantHallDevelopment

You can call: OnLobbyReceived.Dispose() when the gameObject is destroyed to prevent multiple callbacks if you re-create the callback multiple times.

Yayap13 avatar Nov 29 '22 16:11 Yayap13