Game.ErrorData
Assembly: Assembly-CSharp (default Unity project assembly)
Namespace: Game.Tools
Type: struct
Base: System.ValueType
Summary:
A plain data struct used to represent an error/validation marker in the game. It links to one or two Entities (temporary and/or permanent), contains a world-space position, and classifies the error by type and severity. Intended for use in ECS systems that report, visualize or process tool/editor errors. The struct is a simple POD (plain-old-data) container — the enum types ErrorType and ErrorSeverity are defined elsewhere in the project.
Fields
-
public Entity m_TempEntity
Holds a reference to a temporary Entity associated with this error (for example, a transient visual marker). The type Entity comes from Unity.Entities. This may be Entity.Null when no temporary entity exists. -
public Entity m_PermanentEntity
Holds a reference to a persistent Entity associated with this error (for example, a persistent object that caused the error). This may be Entity.Null when not applicable. -
public float3 m_Position
World-space position of the error marker. The float3 type comes from Unity.Mathematics and is typically used for positioning visual/error indicators in the scene. -
public ErrorType m_ErrorType
Classification of the error. ErrorType is an enum defined elsewhere; it identifies the kind of error or validation issue (e.g., Placement, Collision, InvalidConfiguration, etc.). -
public ErrorSeverity m_ErrorSeverity
Severity level for the error. ErrorSeverity is an enum defined elsewhere and indicates how serious the issue is (e.g., Info, Warning, Error, Critical).
Properties
- None.
This struct exposes only public fields and defines no properties.
Constructors
public ErrorData()
The default parameterless constructor is provided implicitly by the C# compiler for structs. It initializes value types to their default values (entities become Entity.Null, float3 becomes (0,0,0), enums default to their zero value). If you need a convenient initializer, consider creating a helper factory method or an explicit constructor in code (note: explicit parameterless constructors are not allowed for structs).
Methods
- None.
This is a simple data container and defines no instance or static methods. Behavior and lifecycle handling is expected to be implemented in ECS systems or utility classes that consume this struct.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Tools;
// Create and populate an ErrorData instance
var error = new ErrorData
{
m_TempEntity = tempEntity, // Entity.Null or a valid temporary marker
m_PermanentEntity = permanentEntity, // Entity.Null or an entity that caused the error
m_Position = new float3(10f, 0f, 20f),
m_ErrorType = ErrorType.Placement,
m_ErrorSeverity = ErrorSeverity.Warning
};
// Example: add to an entity as a component (if this struct is used as an IComponentData)
entityManager.AddComponentData(someEntity, error);
// Or store in a NativeList for processing in a system
nativeErrorList.Add(error);
Notes: - Ensure ErrorType and ErrorSeverity enums are available in your mod/project; adjust enum values to match your tooling. - Because this struct uses Unity ECS types (Entity, float3), it is intended to be used inside Systems, ComponentData, or job contexts where these types are valid.