I’m implementing some Steam API callbacks, manually because the automated STEAM_CALLBACK is triggering twice. The STEAM_CALLBACK_MANUAL is only calling once when registering a function, but it is removed after about 30 seconds by GC. I tried putting in a wrapper class, same results. In the functions, the logout shows it is firing until it is deleted. I tried SharedPtr as well without using the macro. I just need to know how to prevent
Declaration and assignment code:
SteamworksGIS.h
STEAM_CALLBACK_MANUAL(USteamworksGIS, OnFriendLobbyUpdate, LobbyChatUpdate_t, OnFriendLobbyUpdateCallback);
STEAM_CALLBACK_MANUAL(USteamworksGIS, OnJoinLobbyRequested, GameLobbyJoinRequested_t, OnJoinLobbyRequestedCallback);
STEAM_CALLBACK_MANUAL( USteamworksGIS, OnPersonaStateChange, PersonaStateChange_t, OnPersonaStateChangeCallback);
SteamworksGIS.cpp
USteamworksGIS::USteamworksGIS() {
OnFriendLobbyUpdateCallback.Register(this, &USteamworksGIS::OnFriendLobbyUpdate);
OnJoinLobbyRequestedCallback.Register(this, &USteamworksGIS::OnJoinLobbyRequested);
OnPersonaStateChangeCallback.Register(this, &USteamworksGIS::OnPersonaStateChange);
}
USteamworksGIS::~USteamworksGIS()
{
OnFriendLobbyUpdateCallback.Unregister();
OnJoinLobbyRequestedCallback.Unregister();
OnPersonaStateChangeCallback.Unregister();
}