public class MyScript : MonoBehaviour
{
protected Callback m_SteamInventoryResult;
private void OnEnable()
{
if (SteamManager.Initialized)
{
m_SteamInventoryResult = Callback<SteamInventoryResult_t>.Create(OnSteamInventoryResult); // this line throws exception
}
else
throw new System.Exception("Steam Manager not initialized!");
}
private void Start()
{
SteamInventory.GetAllItems(out SteamInventoryResult_t handle);
}
private void OnSteamInventoryResult(SteamInventoryResult_t p_callback)
{
print("method pass");
SteamInventory.DestroyResult(p_callback);
}
}
4. Change appid in project directory/steam_appid.txt
5. Create new scene
6. Add game object with SteamManager and MyScript
7. Play the scene
8. Exception:
Exception: Callback number not found for struct Steamworks.SteamInventoryResult_t
Steamworks.CallbackIdentities.GetCallbackIdentity (System.Type callbackStruct) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackIdentity.cs:22)
Steamworks.CallbackDispatcher.Register (Steamworks.Callback cb) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:78)
Steamworks.Callback1[T].Register (Steamworks.Callback1+DispatchDelegate[T] func) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:272)
Steamworks.Callback1[T]..ctor (Steamworks.Callback1+DispatchDelegate[T] func, System.Boolean bGameServer) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:240)
Steamworks.Callback1[T].Create (Steamworks.Callback1+DispatchDelegate[T] func) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:226)
MyScript.OnEnable () (at Assets/Scripts/MyScript.cs:12)
Steps for Reproduction:
public class MyScript : MonoBehaviour { protected Callback m_SteamInventoryResult;
}
Exception: Callback number not found for struct Steamworks.SteamInventoryResult_t Steamworks.CallbackIdentities.GetCallbackIdentity (System.Type callbackStruct) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackIdentity.cs:22) Steamworks.CallbackDispatcher.Register (Steamworks.Callback cb) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:78) Steamworks.Callback
1[T].Register (Steamworks.Callback
1+DispatchDelegate[T] func) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:272) Steamworks.Callback1[T]..ctor (Steamworks.Callback
1+DispatchDelegate[T] func, System.Boolean bGameServer) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:240) Steamworks.Callback1[T].Create (Steamworks.Callback
1+DispatchDelegate[T] func) (at ./Library/PackageCache/com.rlabrecque.steamworks.net@a3fe8091f7/Runtime/CallbackDispatcher.cs:226) MyScript.OnEnable () (at Assets/Scripts/MyScript.cs:12)