Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

updated check for current build target #538

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ public sealed class CurrentBuildTargetPlatform : BasePlatform
/// <returns>True, if any build target is active.</returns>
public static bool IsBuildTargetActive(List<IMixedRealityPlatform> platforms)
{
if (!Application.isEditor) { return false; }

var isEditor = false;
var isBuildTargetActive = false;
var isEditorPlatformActive = false;
var isEditorPlatformPresent = false;

foreach (var platform in platforms)
{
Expand All @@ -35,7 +33,7 @@ public static bool IsBuildTargetActive(List<IMixedRealityPlatform> platforms)
case AllPlatforms _:
return true;
case CurrentBuildTargetPlatform _:
isEditor = true;
isEditorPlatformPresent = true;
isEditorPlatformActive = platform.IsAvailable;
break;
default:
Expand All @@ -44,7 +42,7 @@ public static bool IsBuildTargetActive(List<IMixedRealityPlatform> platforms)
}
}

return !isEditor || isBuildTargetActive && isEditorPlatformActive;
return !isEditorPlatformPresent || isBuildTargetActive && isEditorPlatformActive;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,8 @@ public static bool TryCreateAndRegisterService<T>(Type concreteType, IReadOnlyLi
return false;
}

if (!CurrentBuildTargetPlatform.IsBuildTargetActive(platforms))
if (Application.isEditor &&
!CurrentBuildTargetPlatform.IsBuildTargetActive(platforms))
{
// We return true so we don't raise en error.
// Even though we did not register the service,
Expand Down