An abstract class for defining Vulkan hardware profiles that Unity includes in Android builds.
Inherit from this class to define device-specific Vulkan hardware profiles for Android. At build time, Unity calls AndroidHardwareProfiles.DefineHardwareProfile to collect your profile configuration, then serializes it into a Profile.json file in the application's assets.
At runtime, Unity uses these profiles to configure graphics API selection, driver workarounds, and graphics jobs settings based on the device hardware.
Note: You can't use Vulkan hardware profiles and Vulkan Device Filtering Assets at the same time. When both exist, hardware profiles take precedence.
For more information, refer to Vulkan hardware profiles.
using UnityEditor.Android; using UnityEditor.HardwareProfiles;
public class MyHardwareProfiles : AndroidHardwareProfiles { public override void DefineHardwareProfile(ProfileDatabase database) { // Configure the default filter for all devices var defaultFilter = database.GetDefaultFilter(); defaultFilter.SetGraphicsAPI(GraphicsAPI.UseVulkan);
// Target specific devices var pixel6 = database.CreateFilter("", "", "((G|g)oogle)", "(oriole|raven|bluejay)"); pixel6.SetGraphicsAPI(GraphicsAPI.UseOpenGles); } }
| Method | Description |
|---|---|
| DefineHardwareProfile | Implement this method to configure Vulkan hardware profiles for the Android build. |
| IsEnabled | Override this method to control whether Unity uses this hardware profile during the Android build. |