samsface / godot-steam-api

Godot Steam integration using GDNative.
402 stars 17 forks source link

Ability to disable plugin at runtime #28

Closed nightblade9 closed 2 years ago

nightblade9 commented 2 years ago

Is it possible to add a function I can call, to disable the Steam integration at runtime?

I use the same code-base for the demo and full version of my game. In my export settings, I have two exports for each platform: one for the demo, and one for the full game. If possible, I would like to disable Steam integration in the demo version, by calling some function to disable the API if I detect the game is running in demo mode.

samsface commented 2 years ago

The switch in project settings won't work for you? @nightblade9

nightblade9 commented 2 years ago

If you mean the project setting under the SteamAPI tab, no, that won't work; I need a way to flip the value in code.

For now, I figured out a work-around on my side (if my game is in demo mode, don't call any of the Steam APIs). It would be nice to be able to turn off the Steam API integration completely.

samsface commented 2 years ago

So, the way Steam is... it's better if we never attempt to switch it off runtime.

But seeing as you have two exports (one for release, one for demo) right? How about a feature flag you set in your demo export that stops Steam loading for that export. If I made the change, you'd just need to add this string to your export's features.

image

nightblade9 commented 2 years ago

So, the way Steam is... it's better if we never attempt to switch it off runtime.

Looks like this is the answer, thanks.

For the feature toggles screnshot that you showed: yes, that's what I'm doing; albeit the feature I'm using is not a new one like disable_steam_integration but is_demo. Functionally, it's the same as having the API switched off.

Thanks,

samsface commented 2 years ago

Ok cool, I've pushed a change that does this so you don't have to. The feature flag is 'disable_steam_integration'.

nightblade9 commented 2 years ago

Awesome, thanks for making this change.