- Home /
Question by
Mutkra · Nov 04, 2020 at 11:16 AM ·
steamachievements
Why in unity editor l can get steam achievements, but without the editor l can't? !
I'm using steamworks NET
Comment
Answer by rh_galaxy · Nov 04, 2020 at 12:15 PM
It probably has to do with your init of steam. Maybe because it uses the txt file steam_appid.txt in the editor...
This is my code (Insert your app_id). Hope it helps.
bool InitValve()
{
try
{
if (SteamAPI.RestartAppIfNecessary((AppId_t)app_id))
{
Debug.LogError("[Steamworks.NET] SteamAPI.RestartAppIfNecessary returned false\n", this);
return false;
}
}
catch (System.DllNotFoundException e)
{
Debug.LogError("[Steamworks.NET] Could not load [lib]steam_api.dll/so/dylib. It's likely not in the correct location.\n" + e, this);
return false;
}
bool bSteamAPIInited = SteamAPI.Init();
if (!bSteamAPIInited)
{
Debug.LogError("[Steamworks.NET] SteamAPI_Init() failed.", this);
return false;
}
// cache the GameID for use in the callbacks
gameID = new CGameID(SteamUtils.GetAppID());
UserStatsReceived = Callback<UserStatsReceived_t>.Create(OnUserStatsReceived);
UserStatsStored = Callback<UserStatsStored_t>.Create(OnUserStatsStored);
UserAchievementStored = Callback<UserAchievementStored_t>.Create(OnAchievementStored);
bool bSuccess = SteamUserStats.RequestCurrentStats();
// get user name
iUserID = SteamUser.GetSteamID().m_SteamID;
szUser = SteamFriends.GetPersonaName();
bUserValid = true;
return true;
}
Your answer
Follow this Question
Related Questions
How to setup achievements in uwp...? 0 Answers
Steamworks.NET - Trying to get achievement name 1 Answer
Unity to steam steamworks achivements 1 Answer
Can't Get Or Set Achievements With Steamworks.NET 1 Answer
Steam Achievements Using Lumosity 0 Answers