Unity
If Unity Mediation is used, the ad loading time can be reduced by pre-initializing the Unity SDK.
danger
If you implement Unity SDK initialization, Unity initialization must be called before the NAM SDK initialization.
Add Unity Module
If NAMSDK/MediationUnity is listed in the Podfile, the UnityAds module with MediationUnity and its dependency can be imported.
pod 'NAMSDK/MediationUnity' # Unity
Import the Unity module to use the Unity SDK.
@import UnityAds;
Initialize
An example of Unity initialization is shown below. When calling the initialization API, enablePerPlacementLoad must always be set to YES.
@import UnityAds;
@interface UnityInitSample : NSObject <UnityAdsInitializationDelegate>
@end
@implementation UnityInitSample
- (void)initialize {
[UnityAds initialize:@"YourGameId" testMode:NO enablePerPlacementLoad:YES initializationDelegate:self];
}
//MARK: - UnityAdsInitializationDelegate
- (void)initializationComplete {
NSLog(@"[UnityInitSample] initializationComplete");
}
- (void)initializationFailed:(UnityAdsInitializationError)error withMessage:(NSString *)message {
NSLog(@"[UnityInitSample] initializationFailed: %d withMessage: %@", error, message);
}
@end