Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DiagnosticParams

Provides numeric parameters with arbitrary names and defaults, with optional overrides for individual target build platforms.
Read time 1 minuteLast updated 7 days ago

Definition

public sealed class DiagnosticParams : ISerializationCallbackReceiver

Remarks

When deciding whether to report a diagnostic issue, some Analyzers need to compare a value extracted from the project with an arbitrary threshold value: For example, when reporting that the project contains textures larger than some specified size. DiagnosticParams are saved in the ProjectAuditorSettings asset, which should be included in the project's version control repository. By default, every AnalysisParams is constructed with a copy of the global DiagnosticParams for use during analysis. Individual parameters can be overridden on different platforms (for example, to set different texture size thresholds on different target platforms). DiagnosticParams will return the parameter value that corresponds to the target platform, or the default parameter if there is no override for the platform.

Constructors

Constructor

Description

DiagnosticParams()Default constructor
DiagnosticParams(Unity.ProjectAuditor.Editor.DiagnosticParams)Copy constructor

Methods

Method

Description

DoGUIDraw project settings GUI for a specific BuildTargetGroup.
GetDefaultGet the default value for this parameter.
GetParameterGet the value of a named parameter. The parameter must have previously been registered with the RegisterParameter method.
OnAfterDeserializeUnity calls this method automatically after deserialization.
OnBeforeSerializeUnity calls this method automatically before serialization.
RegisterParameterRegister a parameter by declaring its name and default value. Parameters are registered on the "default" platform, so are available for retrieval on every target platform.
SetAnalysisPlatformSets the target analysis platform. When retrieving parameters, DiagnosticParams will first check the values specific to this platform.
SetParameterSet the value of a named parameter for a given analysis platform.