dakuru
11/21/2025, 3:03 PMJurjen
11/24/2025, 1:01 PMIPlayerModelClientListener member to your PlayerCurrenciesModel. Then in IMetaplayLifecycleDelegate.OnSessionStartedAsync, also set the instance to the sub model. e.g.
cs
async Task IMetaplayLifecycleDelegate.OnSessionStartedAsync()
{
// Hook up to updates in PlayerModel.
MetaplayClient.PlayerModel.PlayerCurrenciesModel.ClientListener = this;
MetaplayClient.PlayerModel.ClientListener = this;
...
}
2. Pass PlayerModel to the subclass in `OnDeserialized`:
cs
[MetaOnDeserialized]
public void OnDeserialized()
{
// Note you have to pass PlayerModel and it can't be ClientListener as it is not yet set in the deserialization callbacks
PlayerCurrenciesModel.PlayerModel = this;
}
3. Add a helper PlayerModel.AddCoins() that can then modify the PlayerCurrenciesModel, and invoke the listener.
Let me know if you'd like further info on any of the proposed solutions. As a side note, we're not super happy with the way client listeners (partially due to this and other issues) work, but unfortunately changing it is fairly low on the priority list. :/