SpaceMadness / lunar-unity-plugin

A UNIX/Quake3 style command line interface to Unity editor
74 stars 8 forks source link

Can't register action: plugin is disabled warnings handle #10

Closed elitvynov closed 4 years ago

elitvynov commented 4 years ago

Hi, I use Lunar Mobile Console Pro for few months and it is very good. The only thing I cannot figure out, is how to get rid of warnings "[Lunar Mobile Console] Can't register action: plugin is disabled". I use this approach: Console is enabled for dev-branch of my app and utilises next logic for cheats:

private void Awake()
        {
            LunarConsole.RegisterAction("Show InterstitialAds", ShowInterstitialAds);
            LunarConsole.RegisterAction("Show RewardedAds", ShowRewardedAds);
            LunarConsole.RegisterAction("Open Next Level", OpenNextLevel);
            LunarConsole.RegisterAction("Reset Progress", ResetProgress);
        }

It works pretty good until I create release-branch where I Disable Console. After this I start getting warnings in Unity Editor and in app Analytics. I was looking for some variable inside LunarConsole class like IsEnabled or something but didn't find. Also I tried to utilise this approach:

private void Awake()
        {
#if LUNAR_CONSOLE_ENABLED
            LunarConsole.RegisterAction("Show InterstitialAds", ShowInterstitialAds);
            LunarConsole.RegisterAction("Show RewardedAds", ShowRewardedAds);
            LunarConsole.RegisterAction("Open Next Level", OpenNextLevel);
            LunarConsole.RegisterAction("Reset Progress", ResetProgress);
#endif
        }

But somewhy LUNAR_CONSOLE_ENABLED / LUNAR_CONSOLE_DISABLED is not visible in scope of Assets/Scripts folder.

Any ideas how to achieve this? Cheers

weeeBox commented 4 years ago

Hey @elitvynov,

I've added a static boolean property LunarConsole.isConsoleEnabled that you can use. Would incorporate into the future release.

Use this patch file for now.

elitvynov commented 4 years ago

@weeeBox Thank you