Space Ad Mobile
9.5.1
Space Ad Mobile makes ads easy to add into your mobile game: one unified workflow for LevelPlay, AdMob, Yandex.Ads across banners, interstitials and rewarded.
Loading...
Searching...
No Matches
RuntimePlatformGuard.cs
1
using
UnityEngine;
2
3
namespace
SCG.SpaceAdMobile
4
{
10
internal
static
class
RuntimePlatformGuard
11
{
15
private
const
string
ErrorText =
16
"["
+ nameof(SpaceAdMobile) +
"] The current platform or build target is not supported. "
+
17
"Supported targets: Android, iOS, or Unity Editor with Android/iOS selected. "
+
18
"Ad operations will be ignored."
;
19
21
private
static
bool
errorLogged;
22
28
public
static
bool
IsRuntimePlatformSupported =>
29
#if UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS
30
true
;
31
#else
32
false
;
33
#endif
34
46
public
static
string
GetAdUnitId(
string
androidId,
string
iosId) =>
47
#if UNITY_EDITOR
48
string
.Empty;
49
#elif UNITY_ANDROID
50
androidId;
51
#elif UNITY_IOS
52
iosId;
53
#else
54
string
.Empty;
55
#endif
56
68
public
static
string
GetPlatformValue(
string
androidValue,
string
iosValue) =>
69
#if UNITY_ANDROID
70
androidValue;
71
#elif UNITY_IOS
72
iosValue;
73
#else
74
string
.Empty;
75
#endif
76
86
public
static
bool
EnsureSupported()
87
{
88
if
(IsRuntimePlatformSupported)
89
return
true
;
90
91
if
(errorLogged)
return
false
;
92
93
errorLogged =
true
;
94
Debug.LogError(ErrorText);
95
return
false
;
96
}
97
}
98
}
SCG.SpaceAdMobile
Definition
AdUnit.cs:7