Skip to content

Commit e6d3a26

Browse files
oddgamesdanielStewart Miles
authored andcommitted
Disabled build system change polling when auto-resolution is disabled.
Methods that used to be hooked into the editor update tick are now able to be unhooked and will not automatically be assigned via the PlayServicesResolver's static constructor if auto resoltution is turned off in the settings. Original: #173 Change-Id: I91f5019f2dec77f9470f38ac8c9fb978a022d7a6
1 parent 63404c2 commit e6d3a26

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

source/PlayServicesResolver/src/PlayServicesResolver.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ static PlayServicesResolver() {
630630
"ProjectSettings",
631631
logMessageWithLevel: LogDelegate);
632632
}
633+
RunOnMainThread.OnUpdate -= PollBundleId;
634+
RunOnMainThread.OnUpdate += PollBundleId;
635+
633636
// Initialize settings and resolve if required.
634637
OnSettingsChanged();
635638

@@ -642,9 +645,21 @@ static PlayServicesResolver() {
642645
ScheduleAutoResolve();
643646
}
644647

645-
// Register events to monitor build system changes for the Android Resolver and other
646-
// plugins.
647-
RunOnMainThread.OnUpdate += PollBundleId;
648+
if (GooglePlayServices.SettingsDialog.EnableAutoResolution) LinkAutoResolution();
649+
}
650+
651+
// Unregister events to monitor build system changes for the Android Resolver and other
652+
// plugins.
653+
public static void UnlinkAutoResolution() {
654+
RunOnMainThread.OnUpdate -= PollBuildSystem;
655+
RunOnMainThread.OnUpdate -= PollAndroidAbis;
656+
RunOnMainThread.OnUpdate -= PollAndroidSdkRoot;
657+
}
658+
659+
// Register events to monitor build system changes for the Android Resolver and other
660+
// plugins.
661+
public static void LinkAutoResolution() {
662+
UnlinkAutoResolution();
648663
RunOnMainThread.OnUpdate += PollBuildSystem;
649664
RunOnMainThread.OnUpdate += PollAndroidAbis;
650665
RunOnMainThread.OnUpdate += PollAndroidSdkRoot;

source/PlayServicesResolver/src/SettingsDialog.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ internal static void RestoreDefaultSettings() {
117117
}
118118

119119
internal static bool EnableAutoResolution {
120-
set { projectSettings.SetBool(AutoResolveKey, value); }
120+
set {
121+
projectSettings.SetBool(AutoResolveKey, value);
122+
if (value) {
123+
PlayServicesResolver.LinkAutoResolution();
124+
} else {
125+
PlayServicesResolver.UnlinkAutoResolution();
126+
}
127+
}
121128
get { return projectSettings.GetBool(AutoResolveKey, true); }
122129
}
123130

0 commit comments

Comments
 (0)