Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IsEnabled()

Override this method to control whether Unity uses this hardware profile during the Android build.
Read time 1 minuteLast updated 13 days ago

Definition

public virtual bool IsEnabled()

Returns

Type

Description

bool

Remarks

Unity calls this method during the build process to determine which AndroidHardwareProfiles implementation to use. Return
true
to include this profile in the build, or
false
to skip it. The default implementation returns
true
.
Override this method to conditionally enable a profile based on build settings, target platform, or other criteria. This is useful when you maintain multiple profile implementations and want to switch between them without removing code.
Note: Only one AndroidHardwareProfiles implementation can be enabled at a time. If multiple implementations return
true
, Unity throws an exception during the build.
Returns
true
if this profile should be used for the build; otherwise,
false
.

Examples

using UnityEditor;using UnityEditor.Android;using UnityEditor.HardwareProfiles;public class PrimaryHardwareProfile : AndroidHardwareProfiles{ // Enable profile for production build public override bool IsEnabled() => EditorUserBuildSettings.development == false; public override void DefineHardwareProfile(ProfileDatabase database) { // Configure the default filter for all devices var defaultFilter = database.GetDefaultFilter(); defaultFilter.SetGraphicsAPI(GraphicsAPI.UseVulkan); }}public class AditionalHardwareProfile : AndroidHardwareProfiles{ // Enable profile for development build public override bool IsEnabled() => EditorUserBuildSettings.development == true; public override void DefineHardwareProfile(ProfileDatabase database) { // Configure the default filter for all devices var defaultFilter = database.GetDefaultFilter(); defaultFilter.SetGraphicsAPI(GraphicsAPI.UseOpenGles); }}