View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.0.0
- Last updated
- First released
- Unity version
- 6000.0.44 or later
- Package size
- 1.5 MB
- Files
- 150
- Favorites
- 1
- Views in the past week
- 7
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- $4.99 on
Keywords
Native Country Picker for Android™ and iOS™ with Editor Integration
Native Country Picker for Android™ & iOS™ with Editor Integration for Unity™ Android is a trademark of Google LLC.
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 3
Native Country Picker for Android™ and iOS™ with Editor Integration screenshot 1
About this asset
Simplify country code input in your Android and iOS games and apps! This plugin features an intuitive country code and name picker with system font flags. Users simply select their country. Easy to integrate and well-tested. Includes well-tested source code for free modification. Supports iOS 15+, Android 22+, Unity 2023 & 6.
Android is a trademark of Google LLC.
From the publisher's Asset Store listing.
Technical details
Features
Native UI Integration: Utilizes the native contact picker UI on both Android and iOS, ensuring a consistent and intuitive user experience that aligns with platform conventions.
Cross-Platform Compatibility Designed to work seamlessly on both Android and iOS platforms with a unified API, simplifying development and deployment.
Clear and Concise API Offers a straightforward and easy-to-use C# API for Unity developers to integrate the country name picker functionality into their applications with minimal code.
Optimized Performance Leverages native platform functionalities for optimal performance and responsiveness.
Easy to Use and Implement, Source Code Included: The plugin boasts a straightforward API designed for ease of integration. The complete source code is included, allowing for free modification and customization to fit your specific project needs.
Thread-Safe: The plugin's core functionality is thread-safe, ensuring reliable operation even in multithreaded Unity environments.
Error-Safe Handling: The API provides robust error-handling mechanisms, allowing you to gracefully manage scenarios where country picking might fail or be canceled by the user.
Async/Await Pattern: The primary API method, `ShowCountryDialogAsync`, utilizes the modern `async/await` pattern for asynchronous operation. This prevents blocking the main Unity thread, ensuring a smooth and responsive user experience.
Unity Editor Dialog: The plugin includes a convenient Unity Editor dialog that mirrors the runtime functionality, allowing for easy testing and iteration directly within the Unity Editor.
System Font Flags: The country selection within the picker utilizes the device's native system fonts to display country flags, ensuring consistent and up-to-date flag visuals.
SwiftUI Showcase: Demonstrates seamless integration between Unity and native iOS SwiftUI, including a practical callback mechanism from native Swift to Unity.
Unity & Jetpack Compose UI Integration Example (Kotlin): Demonstrates seamless integration between Unity and native Android Jetpack Compose UI (Kotlin), including a practical callback mechanism from native Kotlin to Unity.
Using the API in C#
Code available here: https://gist.github.com/protorius42/ec013279e0b9bc1ef0f4ac19912d0b7b
// (1) Create an instance of NativeCountryPicker
var picker = new NativeCountryPicker();
// (2) Create parameters for the dialog
var pickerParams = new NativeCountryPickerParams(label: "What's your country?", selectedCountry: "US", closeButtonLabel: "Close";
//(3) Show the country picker dialog asynchronously
var result = await picker.ShowCountryDialogAsync(pickerParams);
// (4) Process the result
if (this.label != null)
{
if (result.Item2 == NativeCountryErrorCodes.NoError)
{
Debug.Log($"[{result.Item1.CountryCode}]{CountryList.Countries[result.Item1.CountryCode].Name}")
} else {
Debug.Log($"Error: {result.Item2}";
}
Compatibility
| Unity version | Built-in | URP | HDRP | Custom |
|---|---|---|---|---|
| 6000.0.44f1 | Compatible | Compatible | Compatible | Compatible |
As listed on the Asset Store.