{"id":25936877,"url":"https://github.com/chartboost/chartboost-core-unity-sdk","last_synced_at":"2025-06-18T10:39:42.522Z","repository":{"id":189024868,"uuid":"659936073","full_name":"ChartBoost/chartboost-core-unity-sdk","owner":"ChartBoost","description":" ChartboostCore SDK is a modular Unity SDK designed as an entry point to manage and facilitate different modules for your Android/iOS application. Each module can be individually initialized and has its metrics collected and reported, offering detailed insights into module performance and potential issues.","archived":false,"fork":false,"pushed_at":"2024-09-19T18:39:48.000Z","size":345,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-18T17:01:54.474Z","etag":null,"topics":["chartboost","core","csharp","library","unity"],"latest_commit_sha":null,"homepage":"https://www.chartboost.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChartBoost.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-28T22:27:24.000Z","updated_at":"2024-09-19T18:39:53.000Z","dependencies_parsed_at":"2024-03-13T03:33:13.471Z","dependency_job_id":"cba5a41d-644d-4f81-b22b-3a2f22a8c527","html_url":"https://github.com/ChartBoost/chartboost-core-unity-sdk","commit_stats":null,"previous_names":["chartboost/chartboost-core-unity-sdk"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-core-unity-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-core-unity-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-core-unity-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChartBoost%2Fchartboost-core-unity-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChartBoost","download_url":"https://codeload.github.com/ChartBoost/chartboost-core-unity-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241773261,"owners_count":20018065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chartboost","core","csharp","library","unity"],"created_at":"2025-03-04T02:54:58.011Z","updated_at":"2025-03-04T02:54:58.608Z","avatar_url":"https://github.com/ChartBoost.png","language":"C#","readme":"# Chartboost Core Unity SDK\r\n\r\n## Summary \r\n\r\nChartboostCore SDK is a modular Unity SDK designed as an entry point to manage and facilitate different modules for your Android/iOS application. Each module can be individually initialized and has its metrics collected and reported, offering detailed insights into module performance and potential issues.\r\n\r\nThe main functionalities provided by the SDK are:\r\n\r\n* Initialization of individual or a set of modules.\r\n* Performance metrics collection during the module initialization process.\r\n* Detailed error tracking and reporting with categorized error codes.\r\n* Centralized logging system with multiple log levels and output options.\r\n\r\n## Minimum Requirements\r\n\r\n| Plugin | Version |\r\n| ------ | ------ |\r\n| Cocoapods | 1.11.3+ |\r\n| iOS | 11.0+ |\r\n| Xcode | 14.1+ |\r\n| Android API | 21+ |\r\n| Unity | 2022.3.+ |\r\n\r\n# Integration\r\n\r\n## Using the public [npm registry](https://www.npmjs.com/search?q=com.chartboost.core)\r\n\r\nIn order to add the Chartboost Core Unity SDK to your project using the npm package, add the following to your Unity Project's ***manifest.json*** file. The scoped registry section is required in order to fetch packages from the NpmJS registry.\r\n\r\n```json\r\n\"dependencies\": {\r\n    \"com.chartboost.core\": \"1.0.1\",\r\n    ...\r\n},\r\n\"scopedRegistries\": [\r\n{\r\n    \"name\": \"NpmJS\",\r\n    \"url\": \"https://registry.npmjs.org\",\r\n    \"scopes\": [\r\n    \"com.chartboost\"\r\n    ]\r\n}\r\n]\r\n```\r\n## Using the public [NuGet package](https://www.nuget.org/packages/Chartboost.CSharp.Core.Unity)\r\n\r\nTo add the Chartboost Core Unity SDK to your project using the NuGet package, you will first need to add the [NugetForUnity](https://github.com/GlitchEnzo/NuGetForUnity) package into your Unity Project.\r\n\r\nThis can be done by adding the following to your Unity Project's ***manifest.json***\r\n\r\n```json\r\n  \"dependencies\": {\r\n    \"com.github-glitchenzo.nugetforunity\": \"https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity\",\r\n    ...\r\n  },\r\n```\r\n\r\nOnce \u003ccode\u003eNugetForUnity\u003c/code\u003e is installed, search for `Chartboost.CSharp.Core.Unity` in the search bar of Nuget Explorer window(Nuget -\u003e Manage Nuget Packages).\r\nYou should be able to see the `Chartboost.CSharp.Core.Unity` package. Choose the appropriate version and install.\r\n\r\n# Usage\r\n\r\n## Creating Modules\r\n\r\nChartboost provides modules to be integrated with Chartboost Core, such as: [Chartboost Mediation](https://github.com/ChartBoost/chartboost-mediation-unity-sdk), [Usercentrics](https://github.com/ChartBoost/chartboost-core-unity-consent-adapter-usercentrics), etc. However, it also provides the option for developer created modules. To create a module, create a class that inherits the `Module` class, as seen in the following example:\r\n\r\n```csharp\r\npublic class TestModule : Module\r\n{\r\n    public override string ModuleId =\u003e \"test_module\";\r\n    public override string ModuleVersion =\u003e \"1.0.0\";\r\n\r\n    private string _configKey = \"default_config_key\";\r\n    \r\n    // The designated initializer for the module. Sets up the module to make it ready to be used.\r\n    protected override async Task\u003cChartboostCoreError?\u003e Initialize(ModuleConfiguration configuration)\r\n    {\r\n        // Perform init operation. Async initialization supported. (Sample code, replace as needed)\r\n        var result = await SomeSDK.Initialize(_configKey);\r\n\r\n        if (result.Error.HasValue)\r\n        {\r\n          // assemble error in a Chartboost Core acceptable format.\r\n          var error = new ChartboostCoreError(result.Error?.Core, result.Error?.Message);\r\n\r\n          // failed initialization.\r\n          return await Task.FromResult\u003cChartboostCoreError?\u003e(error)\r\n        }\r\n        \r\n        // success\r\n        return null;\r\n    }\r\n\r\n    /// \u003csummary\u003e\r\n    /// Updates the Module with JSON data from the server. A publisher is recommended to\r\n    /// initialize via the constructor with module-specific parameters rather than using this function.\r\n    /// When creating a module, please make sure it's possible to send a credentials\r\n    /// object to set up the parameters of this module.\r\n    ///\r\n    /// Note: Modules should not perform costly operations on this initializer.\r\n    /// ChartboostCore SDK may instantiate and discard several instances of the same module.\r\n    /// ChartboostCore SDK keeps strong references to modules that are successfully initialized.\r\n    /// \u003c/summary\u003e\r\n    /// \u003cparam name=\"credentials\"\u003eA credentials object containing all the information required to initialize\r\n    /// this module, as defined on the Chartboost Core's dashboard.\u003c/param\u003e\r\n    protected override void UpdateCredentials(IReadOnlyDictionary\u003cstring, object\u003e credentials)\r\n    {\r\n        base.UpdateCredentials(credentials);\r\n        \r\n       if (credentials.TryGetValue(\"config_key\", out var key))\r\n       {\r\n          // update values as neeeded utilizing the config field. This allows for remote module initialization.\r\n          _configKey = key;\r\n       }\r\n    }\r\n}\r\n```\r\n\r\n## Initializing Chartboost Core \u0026 Chartboost Core Modules\r\n\r\nIn order to initialize Chartboost Core and Chartboost Code modules, you must call `ChartboostCore.Initialize`. Initialization can be configured as needed by utilizing the `SDKConfiguration` class, see example below:\r\n\r\n```csharp\r\nconst string chartboostApplicationIdentifier = \"CHARTBOOST_APPLICATION_IDENTIFIER\";\r\n\r\n// List of all client-modules we wish to initialize. Note that any remote modules will always be attempted to be initialized.\r\nList\u003cModules\u003e modulesToInitialize = new List\u003cModules\u003e();\r\n\r\nvar testModule = new TestModule();\r\n\r\n// When having a explicit reference to a module, we can get notified of its readiness by using the C# specific ModuleReady event.\r\ntestMOdule.ModuleReady += module =\u003e Debug.Log($\"Module: {module.ModuleId}/{module.ModuleVersion} is ready!\");\r\n\r\nmodulesToInitialize.Add(testModule);\r\n\r\n// HashSet of modules we wish to skip initialization. This could be modules that are already initialize, or that we do not wish to init for specific clients.\r\nvar modulesToSkipInitialization = new HashSet\u003cString\u003e();\r\n\r\n// Using Chartboost Mediation as a remote module example. There isn't an explicit Module object for Chartboost Mediation.\r\nmodulesToSkipInitialization.Add(ChartboostMediation.CoreModuleId);\r\n\r\nvar sdkConfig = new SDKConfiguration(chartboostApplicationIdentifier, modulesToInitialize, modulesToSkipInitialization);\r\n\r\n// Initialize Chartboost Core utilize the SDKConfiguration object.\r\nChartboostCore.Initialize(sdkConfig);\r\n```\r\n\r\n## Module Initialization Results\r\n\r\nThere are multiple ways to be notified for when a `Module` initialization process is completed.\r\n\r\n### Unity - Client Modules\r\n\r\nIf you are initializing Unity modules locally, you can subscribe to their corresponding `ModuleReady` event, this will notify you when the initialization process is completed and the `Module` is ready to be used. e.g:\r\n\r\n```csharp\r\nvar testModule = new TestModule();\r\ntestModule.ModuleReady  +=  testModule =\u003e Debug.Log($\"Module: {testModule.ModuleId} is ready\");\r\n```\r\n\r\n\u003e **Warning** \\\r\n\u003e This callback is not very useful for Chartboost Core modules that aren't expliclty exposed to developers or modules initialized automatically through the backend.\r\n\r\n### ChartboostCore.ModuleInitializationCompleted Event\r\n\r\nIf you wish to have granular details about Chartboost Core Module initialization details, you can subscribe to the `ChartboostCore.ModuleInitializationCompleted`, where information for Client/Remote modules is readily available, as seen below:\r\n\r\n```csharp\r\nChartboostCore.ModuleInitializationCompleted += result =\u003e\r\n{\r\n    Debug.Log($\"Received initialization result for: {result.ModuleId} start:{result.Start}, end:{result.End} with duration: {result.Duration}\");\r\n\r\n    // Module failed to initialize module\r\n    if (result.Error.HasValue) \r\n        Debug.LogError($\"Module: {result.ModuleId} failed to initialize with error: {JsonTools.SerializeObject(result.Error.Value)}\");\r\n    // Modue succeeded to initialize, add to list of modules to skip to pass on the next ChartboostCore.Initialize call.\r\n    else\r\n        modulesToSkip.Add(result.ModuleId);\r\n};\r\n```\r\n\r\n## Publisher Metadata\r\n\r\nChartboost Core allows developer to set Publisher provided metadata, as seen in the following examples.\r\n\r\n### IsUserUnderage\r\nIndicates if the user is underage as determined by the publisher.\r\n\r\n```csharp\r\n// Is underage\r\nChartboostCore.PublisherMedata.SetIsUserUnderage(true);\r\n\r\n// Is not underage\r\nChartboostCore.PublisherMedata.SetIsUserUnderage(false);\r\n```\r\n\r\n### PublisherSessionIdentifier\r\nSets a publisher-defined session identifier.\r\n\r\n```csharp\r\nChartboostCore.PublisherMedata.SetPublisherSessionIdentifier(\"PUBLISHER_DEFINED_SESSION_IDENTIFIER\");\r\n```\r\n\r\n### PublisherAppIdentifier\r\nSets a publisher-defined application identifier.\r\n\r\n```csharp\r\nChartboostCore.PublisherMedata.SetPublisherAppIdentifier(\"PUBLISHER_DEFINED_APP_IDENTIFIER\");\r\n```\r\n\r\n### Framework\r\nSets the framework name and version.\r\n\r\n```csharp\r\nChartboostCore.PublisherMetadata.SetFramework(\"Unity\", Application.unityVersion);\r\n```\r\n\r\n### PlayerIdentifier\r\nSets a publisher-defined player identifier.\r\n\r\n```csharp\r\nChartboostCore.PublisherMedata.SetPlayerIdentifier(\"PLAYER_IDENTIFIER\");\r\n```\r\n\r\n## Environments\r\n\r\n### Attribution\r\nAn environment that contains information intended solely for attribution purposes.\r\n\r\n```csharp\r\n// The system advertising identifier.\r\nTask\u003cstring?\u003e advertisingIdentifier = await ChartboostCore.AttributionEnvironment.AdvertisingIdentifier;\r\n\r\n// The device user agent.\r\nTask\u003cstring?\u003e userAgent = await ChartboostCore.AttributionEnvironment.AdvertisingIdentifier;\r\n```\r\n\r\n### Advertising\r\nAn environment that contains information intended solely for advertising purposes.\r\n\r\n```csharp\r\n\r\n// The OS name, e.g. “iOS”, \"Android\", etc.\r\nstring osName = ChartboostCore.AttributionEnvironment.OSName;\r\n\r\n// The OS version, e.g. “17.0”.\r\nstring osVersion = ChartboostCore.AttributionEnvironment.OSVersion;\r\n\r\n// The device make, e.g. “Apple”.\r\nvar deviceMake = ChartboostCore.AttributionEnvironment.DeviceMake;\r\nstring\r\n// The device model, e.g. “iPhone11,2”.\r\nstring deviceModule = ChartboostCore.AttributionEnvironment.DeviceModel;\r\n\r\n// The device locale string, e.g. “en-US”.\r\nstring? deviceLocale = ChartboostCore.AttributionEnvironment.DeviceLocale;\r\n\r\n// The height of the screen in pixels.\r\ndouble? screenHeightPixels = ChartboostCore.AttributionEnvironment.ScreenHeightPixels;\r\n\r\n// The screen scale.\r\ndouble? screenScale = ChartboostCore.AttributionEnvironment.ScreenScale;\r\n\r\n// The width of the screen in pixels.\r\ndouble? screenWidthPixels = ChartboostCore.AttributionEnvironment.ScreenWidthPixels;\r\n\r\n// The app bundle identifier.\r\nstring? bundleIdentifier = ChartboostCore.AttributionEnvironment.BundleIdentifier;\r\n\r\n// Indicates whether the user has limited ad tracking enabled.\r\nTask\u003cbool?\u003e limitedAdtrackingEnabled = await ChartboostCore.AttributionEnvironment.LimitAdTrackingEnabled;\r\n\r\n// The system advertising identifier.\r\nTask\u003cstring?\u003e  advertisingIdentifier = await ChartboostCore.AttributionEnvironment.AdvertisingIdentifier;\r\n```\r\n### Analytics\r\nAn environment that contains information intended solely for analytics purposes. The Analytics environment contains the same fields as the `IAttributionEnvironment` and `IAdvertisingEnvironment` plus the following:\r\n\r\n```csharp\r\n// The current network connection type, e.g. wifi.\r\nNetworkConnectionType networkConnectionType = ChartboostCore.AnalyticsEnvironment.NetworkConnectionType;\r\n\r\n// The device volume level.\r\ndouble? volume = ChartboostCore.AnalyticsEnvironment.Volume; \r\n\r\n// The system identifier for vendor (IFV).\r\nTask\u003cstring?\u003e vendorIdentifier = await ChartboostCore.AnalyticsEnvironment.VendorIdentifier; \r\n\r\n// The scope of the identifier for vendor.\r\nTask\u003cVendorIdentifierScope\u003e vendorIdentifierScope = await ChartboostCore.AnalyticsEnvironment.VendorIdentifierScope; \r\n\r\n// The tracking authorization status, as determined by the system’s AppTrackingTransparency framework. Requires iOS 14.0+. Only supported in iOS devices, other platforms default to Unsupported.\r\nAuthorizationStatus appTrackingTransparencyStatus = ChartboostCore.AnalyticsEnvironment.AppTrackingTransparencyStatus; \r\n\r\n// The version of the app.\r\nstring? appTrackingTransparencyStatus = ChartboostCore.AnalyticsEnvironment.AppVersion; \r\n\r\n// The session duration, or 0 if the ChartboostCore.Initialize method has not been called yet. A session starts the moment ChartboostCore.Initialize is called for the first time.\r\ndouble appSessionDuration = ChartboostCore.AnalyticsEnvironment.AppSessionDuration; \r\n\r\n// The session identifier, or null if the ChartboostCore.Initialize method has not been called yet. A session starts the moment ChartboostCore.Initialize is called for the first time.\r\nstring? appSessionIdentifier = ChartboostCore.AnalyticsEnvironment.AppSessionIdentifier; \r\n\r\n// Indicates whether the user is underage. This is determined by the latest value set by the publisher through a call to IPublisherMetadata.SetIsUserUnderage, as well as by the “child-directed” option defined on the Chartboost Core dashboard.\r\nbool? isUserUnderage = ChartboostCore.AnalyticsEnvironment.IsUserUnderage;\r\n\r\n// The publisher-defined session identifier set by the publisher through a call to IPublisherMetadata.SetPublisherSessionIdentifier.\r\nstring? publisherSessionIdentifier = ChartboostCore.AnalyticsEnvironment.PublisherSessionIdentifier;\r\n\r\n// The publisher-defined app identifier set by the publisher through a call to IPublisherMetadata.SetPublisherAppIdentifier.\r\nstring? publisherAppIdentifier = ChartboostCore.AnalyticsEnvironment.PublisherAppIdentifier;\r\n\r\n// The framework name set by the publisher through a call to IPublisherMetadata.SetFramework.\r\nstring? frameworkName = ChartboostCore.AnalyticsEnvironment.FrameworkName;\r\n\r\n// The framework version set by the publisher through a call to IPublisherMetadata.SetFramework.\r\nstring? frameworkVersion = ChartboostCore.AnalyticsEnvironment.FrameworkVersion;\r\n\r\n// The player identifier set by the publisher through a call to \u003csee cref=\"IPublisherMetadata.SetPlayerIdentifier\"/\u003e.\r\nstring? frameworkVersion = ChartboostCore.AnalyticsEnvironment.PlayerIdentifier;\r\n```\r\n\r\nAdditionally, developers can subscribe to `IPublisherMetadata` values change through the `CharboostCore.AnalyticsEnvironment` events, as seen below:\r\n\r\n```csharp\r\n// Using FrameworkName as an example\r\nChartboostCore.AnalyticsEnvironment.FrameworkNameChanged += () =\u003e Debug.Log($\"FrameworkNameChanged, with value: {ChartboostCore.AnalyticsEnvironment.FrameworkName}\");\r\n```\r\n\r\n## Consent\r\n\r\nChartboost Core defines a unified API for publishers to request and query user consent, and relies on a 3rd-party CMP SDK to provide the CMP functionality.\r\n\r\nIn order to utilize Chartboost Core Unified API, make sure a consent module such as: [Usercentrics](https://github.com/ChartBoost/chartboost-core-unity-consent-adapter-usercentrics) is initialized as a module. See example below:\r\n\r\n```csharp\r\nstring chartboostApplicationIdentifier = \"CHARTBOOST_APPLICATION_IDENTIFIER\";\r\n\r\nList\u003cModule\u003e modulesToInitialize = new List\u003cModule\u003e();\r\n\r\n// create usercentrics options configuration object\r\nUsercentricsOptions usercentricsOptions = new UsercentricsOptions(\"USERCENTICS_SETTINGS_ID\");\r\n\r\n// template to partner id can be passed as an optional paramter, but a default set is provided.\r\nUsercentricsAdapter usercentricsAdapter = new UsercentricsAdapter(usercentricsOptions);\r\n\r\nSDKConfiguration sdkConfig = new SDKConfiguration(chartboostApplicationIdentifier, modulesToInitialize);\r\n\r\n// Initialize Chartboost Core and Usercentrics.\r\nChartboostCore.Initialize(sdkConfig);\r\n```\r\n\r\n### Consents\r\nDetailed consent status for each consent standard, as determined by the CMP.\r\n\r\n```csharp\r\nforeach (var consent in ChartboostCore.Consent.Consents) \r\n  Debug.Log($\"ConsentKey {consent.Key} with ConsentValue {consent.Value}\");\r\n```\r\n\r\n### ShouldCollectConsent\r\nIndicates whether the CMP has determined that consent should be collected from the user.\r\n\r\n```csharp\r\n//  Returns false if no consent adapter module is available.\r\nvar shouldCollectConsent = ChartboostCore.Consent.ShouldCollectConsent;\r\n```\r\n\r\n### GrantConsent\r\nInforms the CMP that the user has granted consent. This method should be used only when a custom consent dialog is presented to the user, thereby making the publisher responsible for the UI-side of collecting consent. In most cases `IConsentManagementPlatform.ShowConsentDialog` should be used instead.\r\n\r\n```csharp\r\n// The consent was collected from the user as a result of an explicit user action.\r\nTask\u003cbool\u003e grantConsentUser = await ChartboostCore.Consent.GrantConsent(ConsentSource.User);\r\n\r\n//  The consent was set by the developer without an explicit user action\r\nTask\u003cbool\u003e grantConsentDeveloper = await ChartboostCore.Consent.GrantConsent(ConsentSource.Developer);\r\n```\r\n\r\n### DenyConsent\r\nInforms the CMP that the user has denied consent. This method should be used only when a custom consent dialog is presented to the user, thereby making the publisher responsible for the UI-side of collecting consent. In most cases `IConsentManagementPlatform.ShowConsentDialog` should be used instead.\r\n\r\n```csharp\r\n// The consent was collected from the user as a result of an explicit user action.\r\nTask\u003cbool\u003e denyConsentUser = await ChartboostCore.Consent.DenyConsent(ConsentSource.User);\r\n\r\n//  The consent was set by the developer without an explicit user action\r\nTask\u003cbool\u003e denyConsentDeveloper = await ChartboostCore.Consent.DenyConsent(ConsentSource.Developer);\r\n```\r\n\r\n### ResetConsent\r\nInforms the CMP that the given consent should be reset. If the CMP does not support the ResetConsent() function or the operation fails for any other reason, the Task is executed with a false parameter.\r\n\r\n```csharp\r\nTask\u003cbool\u003e denyConsentUser = await ChartboostCore.Consent.ResetConsent();\r\n```\r\n\r\n### ShowConsentDialog\r\nInstructs the CMP to present a consent dialog to the user for the purpose of collecting consent.\r\n\r\n```csharp\r\n// A non-intrusive dialog used to collect consent, presenting a minimum amount of information.\r\nTask\u003cbool\u003e showConsentConcise = await ChartboostCore.Consent.ShowConsentDialog(ConsentDialogType.Concise);\r\n\r\n// A dialog used to collect consent, presenting detailed information and possibly allowing for granular consent choices.\r\nTask\u003cbool\u003e showConsentDetailed = await ChartboostCore.Consent.ShowConsentDialog(ConsentDialogType.Detailed);\r\n```\r\n\r\n### ConsentChangeWithFullConsents \u0026 ConsentModuleReadyWithInitialConsents\r\n\r\nChartboost Core unified API provided consent specific events to be used as needed:\r\n\r\n```csharp\r\n\r\n// Called when the initial values for IConsentManagementPlatform.Consents first become available for the current session.\r\nChartboostCore.Consent.ConsentModuleReadyWithInitialConsents += initialConsents =\u003e {\r\n  foreach (var consent in initialConsents)\r\n  {\r\n    Debug.Log($\"ConsentKey {consent.Key} with ConsentValue {consent.Value}\");\r\n  }\r\n}\r\n\r\n// Called whenever the IConsentManagementPlatform.Consents value changed.\r\nChartboostCore.Consent.ConsentModuleReadyWithInitialConsents += (fullConsents, modifiedKeys) =\u003e {\r\n  Debug.Log($\"Full Consents: {JsonTools.SerializeObject(fullConsents)}\");\r\n  Debug.Log($\"Modified Keys: {JsonTools.SerializeObject(modifiedKeys)}\");\r\n}\r\n```\r\n\r\n## Calling Async Code from Sync Contexts\r\n\r\nA lot of APIs provided in the Chartboost Core Unity SDK utilize the async/await C# implementation. It is possible for developers to try to call the following code from a sync context where async/await might not be supported:\r\n\r\n```csharp\r\nTask\u003cbool\u003e showConsentConcise = await ChartboostCore.Consent.ShowConsentDialog(ConsentDialogType.Concise);\r\n```\r\n\r\nWe have provided tools to allow for such async calls to be called form sync contexts. Utilize `ContinueWithOnMainThread` task extension for this purpose.\r\n\r\n```csharp\r\nChartboostCore.Consent.ShowConsentDialog(ConsentDialogType.Concise).ContinueWithOnMainThread(continuation =\u003e\r\n{\r\n    Debug.Log($\"ShowConsentDialog finished with status: {continuation.Result}\");\r\n});\r\n```\r\n\r\n# Contributions\r\n\r\nWe are committed to a fully transparent development process and highly appreciate any contributions. Our team regularly monitors and investigates all submissions for the inclusion in our official releases.\r\n\r\n# License\r\n\r\nRefer to our [LICENSE](LICENSE.md) file for more information.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fchartboost-core-unity-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchartboost%2Fchartboost-core-unity-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchartboost%2Fchartboost-core-unity-sdk/lists"}