Class ReportItem
Describes an issue that ProjectAuditor reports in the Unity project.
Inherited Members
Namespace: Unity.ProjectAuditor .Editor
Assembly: Unity.ProjectAuditor.Editor.dll
Syntax
[Serializable]
public class ReportItem
Properties
Category
This issue's category (read-only).
Declaration
[JsonProperty("category")]
public IssueCategory Category { get; }
Property Value
Type | Description |
---|---|
Issue |
CustomProperties
Custom properties. See the "moduleMetadata" section of an exported Report JSON file for information on the formats and meanings of the custom properties for each IssueCategory.
Declaration
[JsonProperty("properties")]
public string[] CustomProperties { get; }
Property Value
Type | Description |
---|---|
string[] |
Description
Project issue Description (read-only).
Declaration
[JsonProperty("description")]
public string Description { get; }
Property Value
Type | Description |
---|---|
string |
FileExtension
File extension of the file that contains this issue.
Declaration
[JsonIgnore]
public string FileExtension { get; }
Property Value
Type | Description |
---|---|
string |
Filename
Name of the file that contains this issue.
Declaration
[JsonIgnore]
public string Filename { get; }
Property Value
Type | Description |
---|---|
string |
Id
An unique identifier for the issue descriptor (read-only).
Declaration
[JsonIgnore]
public DescriptorId Id { get; }
Property Value
Type | Description |
---|---|
Descriptor |
Remarks
Reports can contain two different types of ReportItem:
- Issues, which indicate a potential problem which should be investigated and possibly fixed: for example, a texture with its Read/Write Enabled checkbox ticked.
- Insights, for informational purposes: for example, general information about a texture in the project.
Issues can be identified by having a valid Descriptor
Line
Line in the file that contains this issue.
Declaration
[JsonIgnore]
public int Line { get; }
Property Value
Type | Description |
---|---|
int |
Location
Location of the Insight or Issue (read-only).
Declaration
[JsonProperty("location")]
public Location Location { get; }
Property Value
Type | Description |
---|---|
Location |
LogLevel
Log level.
Declaration
[JsonIgnore]
public LogLevel LogLevel { get; }
Property Value
Type | Description |
---|---|
Log |
RelativePath
Relative path of the file that contains this issue.
Declaration
[JsonIgnore]
public string RelativePath { get; }
Property Value
Type | Description |
---|---|
string |
Severity
Issue-specific Severity (read-only).
Declaration
[JsonIgnore]
public Severity Severity { get; }
Property Value
Type | Description |
---|---|
Severity |
Methods
GetCustomPropertyBool<T>(T)
Check whether a custom property is a boolean type and whether its value is true.
Declaration
public bool GetCustomPropertyBool<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
bool | Returns the property's value if the property is valid and if the value type is boolean. Otherwise, returns false. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomPropertyDouble<T>(T)
Check whether a custom property is a double type and return its value.
Declaration
public double GetCustomPropertyDouble<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
double | Returns the property's value if the property is valid and if the value is a double type. Otherwise, returns 0.0. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomPropertyFloat<T>(T)
Check whether a custom property is a float type and return its value.
Declaration
public float GetCustomPropertyFloat<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
float | Returns the property's value if the property is valid and if the value is a float type. Otherwise, returns 0.0f. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomPropertyInt32<T>(T)
Check whether a custom property is an integer type and return its value.
Declaration
public int GetCustomPropertyInt32<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
int | Returns the property's value if the property is valid and if the value is an integer type. Otherwise, returns 0. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomPropertyInt64<T>(T)
Check whether a custom property is a long type and return its value.
Declaration
public long GetCustomPropertyInt64<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
long | Returns the property's value if the property is valid and if the value is a long type. Otherwise, returns 0. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomPropertyUInt64<T>(T)
Check whether a custom property is a ulong type and return its value.
Declaration
public ulong GetCustomPropertyUInt64<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
ulong | Returns the property's value if the property is valid and if the value is a ulong type. Otherwise, returns 0. |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetCustomProperty<T>(T)
Get a custom property string given an enum.
Declaration
public string GetCustomProperty<T>(T propertyEnum) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
Returns
Type | Description |
---|---|
string | Property name string |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |
GetNumCustomProperties()
Gets the number of custom properties this issue has.
Declaration
public int GetNumCustomProperties()
Returns
Type | Description |
---|---|
int | The number of custom property strings |
IsIssue()
Checks whether this ReportItem represents an Issue.
Declaration
public bool IsIssue()
Returns
Type | Description |
---|---|
bool | True if the issue's descriptor ID is valid. Otherwise, returns false. |
IsMajorOrCritical()
Checks whether this issue is major or critical.
Declaration
public bool IsMajorOrCritical()
Returns
Type | Description |
---|---|
bool | True if the issue's Severity is Major or Critical. Otherwise, returns false. |
IsValid()
Checks whether this issue is valid.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
bool | True if the issue has a valid description string. Otherwise, returns false. |
SetCustomProperty<T>(T, object)
Set a custom property.
Declaration
public void SetCustomProperty<T>(T propertyEnum, object property) where T : struct
Parameters
Type | Name | Description |
---|---|---|
T | propertyEnum | Enum value indicating a property. |
object | property | An object containing a value for the property |
Type Parameters
Name | Description |
---|---|
T | Can be any struct, but the method expects an enum |