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
SCG.SpaceAdMobile.AdUnit< TAd > Class Template Referenceabstract

Defines a generic abstract base class for ad unit objects, encapsulating common functionalities such as SDK initialization checks, system ad type information, ad caching, and ID management based on the platform and ad mode. This class serves as a foundation for implementing specific types of ad units across different platforms, handling critical tasks like ad object storage, logging initialization, option validation, internet connectivity checks, and platform-specific ID selection. More...

Inheritance diagram for SCG.SpaceAdMobile.AdUnit< TAd >:

Public Member Functions

override bool Load ()
 Loads the ad.
override bool CanShowAd ()
 Verifies if the ad is ready to be shown.
Returns
True if the ad can be shown, otherwise false.

override void Show ()
 Shows the ad.
override void Unload ()
 Unloads the ad.
Public Member Functions inherited from SCG.SpaceAdMobile.AdUnitBehaviourBase
bool Load ()
 Loads the ad.
bool CanShowAd ()
 Verifies if the ad is ready to be shown.
void Show ()
 Shows the ad.
void Unload ()
 Unloads the ad.

Protected Member Functions

override void Awake ()
override void OnEnable ()
override void OnDestroy ()
override void OnApplicationQuit ()
bool TryPrepareLoad ()
 Performs shared loading preflight used by synchronous and asynchronous provider implementations. This method preserves the existing load lifecycle, including cache restoration, unload-before-load behavior, SDK readiness checks, and internet availability checks.
override void OnAdLoadedInternal ()
bool LoadInternal ()
SpaceAdLogger InitLogger ()
 Initializes and returns a logger.
string GetId ()
 Determines and returns the appropriate ad ID based on the current platform and ad mode. This method supports different IDs for development and production environments across Android and iOS platforms. Returns an empty string when running in the Unity Editor.
Protected Member Functions inherited from SCG.SpaceAdMobile.AdUnitHandlerBase
override void OnAdPaid (object adValue)
 Raised when the AdObject is estimated to have earned money.
virtual void OnAdPaidInternal (object adValue)
override void OnAdImpressionRecorded ()
 Raised when an impression is recorded for an AdObject.
virtual void OnAdImpressionRecordedInternal ()
override void OnAdLoaded ()
 Raised when the AdObject is loaded.
override void OnAdLoadFailed (object error)
 Raised when loading of the AdObject is failed.
virtual void OnAdLoadFailedInternal (object error)
override void OnAdClicked ()
 Raised when a click is recorded for an AdObject.
virtual void OnAdClickedInternal ()
override void OnAdShown ()
 Raised when an AdObject opened full screen content.
virtual void OnAdShownInternal ()
override void OnAdClosed ()
 Raised when the AdObject closed full screen content.
virtual void OnAdClosedInternal ()
override void OnAdContentFailed (object error)
 Raised when the AdObject failed to open full screen content.
Parameters
errorAd error

virtual void OnAdContentFailedInternal (object error)
override void OnUserEarnedReward (AdRewardBase reward)
 Raised when the AdObject rewarded the user.
Parameters
rewardReward

virtual void OnUserEarnedRewardInternal (AdRewardBase reward)
override void OnDestroy ()
 Releases resources during Unity's destroy callback.
Protected Member Functions inherited from SCG.SpaceAdMobile.AdUnitBase
void OnLoadFromCache ()
 Method to be called when the object is loaded from the cache. It needs to subscribe to needed events.
void OnAttachToCache ()
 Method to be called when the object is attached to the cache. It needs to unsubscribe from events it previously subscribed to.
void RegisterEventHandlers ()
 To further customize the behavior of your ad, you can hook into a number of events in the ad's lifecycle: opening, closing, and so on. Listen for these events by registering a delegate as shown below.
virtual void OnInternetNotAvailable ()
 Raised when the Internet connection isn't available. Can be overridden to handle this scenario.
virtual System.IDisposable AcquireFullscreenAdAudio ()
 Acquires the audio policy for a fullscreen ad show.
void ReleaseFullscreenAdAudio ()
 Releases the audio policy for the current fullscreen ad show.
void AcquireFullscreenAdAudioLease ()
 Replaces the current fullscreen audio lease with a new one.
Protected Member Functions inherited from SCG.SpaceAdMobile.AdUnitBehaviourBase
void Awake ()
 Initializes the component during Unity's Awake callback.
void OnEnable ()
 Handles the Unity enable callback.
void OnDestroy ()
 Releases resources during Unity's destroy callback.
void OnApplicationQuit ()
 Handles application shutdown.
virtual void UnityAwake ()
 Unity Awake.
virtual void UnityOnEnable ()
 Unity OnEnable.
virtual void UnityOnDestroy ()
 Unity OnDestroy.
virtual void UnityOnApplicationQuit ()
 Unity OnApplicationQuit.
void ShowInternal ()
 Internal method for showing an ad. Must be implemented to handle the specific showing logic.
void DestroyInternal ()
 Internal method for unloading an ad. Must be implemented to handle the specific unloading logic.
virtual void OnUnload ()
 Called when an ad is unloaded. Can be overridden to perform clean-up or other logic when the ad is no longer needed.

Properties

TAd AdObject [get, protected set]
 The ad object associated with this unit. This property allows for direct interaction with the specific ad's functionalities.
override AdBehaviour AdBehaviour [get]
override MessageOptions MessageOptions [get]
virtual AdvertisingOptions Options [get, set]
virtual IInternetConnectionChecker InternetConnection [get, set]
virtual LogOptions LogOptions [get]
SpaceAdLogger Logger [get]
virtual bool ShouldUnloadOnLoad [get]
 Determines whether the ad object should be unloaded when loading a new ad instance. When set to true, the current ad will be unloaded upon loading a new one.
virtual bool ShouldUnloadOnShow [get]
 Determines whether the ad object should be treated as unavailable after being shown. When set to true, the current ad will no longer be considered ready after a successful show.
bool SdkInitialized [get]
 Indicates if the necessary SDK has been properly initialized. This is critical for ensuring that ad operations are only attempted when the SDK is ready.
Type SystemAdType [get]
 Stores the type of the system ad, facilitating reflection and type-specific operations.
string SystemAdTypeName [get]
 A convenient string representation of the system ad type, used primarily for logging and debugging purposes.
Properties inherited from SCG.SpaceAdMobile.AdUnitBase
override AdType AdType [get]
 Gets the common advertising format exposed by this ad unit.
AdBehaviour AdBehaviour [get]
 Behavior options for displaying and showing ads.
MessageOptions MessageOptions [get]
 Options for enabling Unity SendMessage methods.
string TestAndroidId [get]
 Gets the Android test ad unit identifier for the active provider.
string TestIOSId [get]
 Gets the iOS test ad unit identifier for the active provider.
Properties inherited from SCG.SpaceAdMobile.AdUnitBehaviourBase
AdType AdType [get]
 Gets the common advertising format exposed by this ad unit.

Additional Inherited Members

Static Public Attributes inherited from SCG.SpaceAdMobile.AdUnitBehaviourBase
const int ExecutionOrder = -25
 Executes ad unit components before most other components to avoid Awake and OnEnable races.
Events inherited from SCG.SpaceAdMobile.AdUnitHandlerBase
Action< object > OnPaid
Action OnImpressionRecorded
Action OnLoaded
Action< object > OnLoadFailed
Action OnClicked
override Action OnShown
Action OnClosed
Action< object > OnContentFailed
Action< AdRewardBase > OnRewarded
Events inherited from SCG.SpaceAdMobile.AdUnitBehaviourBase
Action OnShown
Events inherited from SCG.SpaceAdMobile.IAdUnit
Action OnShown
 Occurs when the ad unit is shown to the user. Subscribers can use this event to update dependent runtime state after the ad becomes visible.

Detailed Description

Defines a generic abstract base class for ad unit objects, encapsulating common functionalities such as SDK initialization checks, system ad type information, ad caching, and ID management based on the platform and ad mode. This class serves as a foundation for implementing specific types of ad units across different platforms, handling critical tasks like ad object storage, logging initialization, option validation, internet connectivity checks, and platform-specific ID selection.

Definition at line 16 of file AdUnit.cs.


The documentation for this class was generated from the following file: