# Настройка бейджей для Unity

Поскольку плагин Unity не содержит заголовочный файл PWNotificationExtensionManager, вам необходимо выполнить несколько дополнительных шагов для внедрения бейджей в ваш проект Unity.


<Aside type="note">
Чтобы внедрить бейджи для нативного приложения iOS, обратитесь к руководству [Настройка бейджей](/ru/developer/pushwoosh-sdk/ios-sdk/setting-up-badges/).
</Aside>

### 1. Добавьте Notification Service Extension (File -> New -> Target...)

<img src="/shared-7.webp" alt=""/>

### 2. Выберите "Notification Service Extension"

<img src="/cross-platform-frameworks-setting-up-badges-for-unity-1.webp" alt=""/>

### 3. Добавьте Pushwoosh.xcframework в таргет расширения NotificationService следующим образом:

1. Выберите таргет расширения **NotificationService**.
2. Перейдите на вкладку "**General**".
3. Найдите раздел '**Framework and Libraries**' и нажмите кнопку '**+**'.
4. Выберите **Pushwoosh.xcframework.**



<img src="/shared-3.webp" alt=""/>

### 4. Обновите код Notification Service Extension следующим образом:

```
#import "NotificationService.h"
#import "PWNotificationExtensionManager.h"

@interface NotificationService ()

@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;

@end

@implementation NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    self.contentHandler = contentHandler;
    self.bestAttemptContent = [request.content mutableCopy];

    [[PWNotificationExtensionManager sharedManager] handleNotificationRequest:request contentHandler:contentHandler];
}

- (void)serviceExtensionTimeWillExpire {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
    self.contentHandler(self.bestAttemptContent);
}

@end
```

### 5. Добавьте "App Groups Capability" для каждого таргета вашего приложения

<img src="/cross-platform-frameworks-setting-up-badges-for-unity-2.webp" alt=""/>

<img src="/cross-platform-frameworks-setting-up-badges-for-unity-3.webp" alt="Возможность App Groups"/>

<img src="/cross-platform-frameworks-setting-up-badges-for-unity-4.webp" alt="Info.plist"/>

### 6. Добавьте App Groups ID в ваш info.plist для каждого таргета вашего приложения

```
<key>PW_APP_GROUPS_NAME</key>
<string>group.com.example.demoapp_example</string>
```

## Поделитесь с нами своим мнением

Ваши отзывы помогают нам улучшать продукт, поэтому мы будем рады, если вы поделитесь с нами любыми проблемами, возникшими в процессе интеграции SDK. Если вы столкнетесь с какими-либо трудностями, пожалуйста, не стесняйтесь поделиться своими мыслями с нами [через эту форму](https://docs.google.com/forms/d/e/1FAIpQLSd\_0b8jwn-V\_JmoPLIxIFYbHACCQhrzidOZV3ELywoQPXRSxw/viewform).