Skip to content

Game.Prefabs.ToolErrorData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: public struct

Base: IComponentData, IQueryTypeParameter

Summary:
Component (IComponentData) used to represent the current error state of a tool or placement operation. Holds an ErrorType value describing what went wrong and a set of ToolErrorFlags that adjust how the error is handled or presented (for example whether to show a tooltip, treat it as blocking, etc.). This struct is intended for use with the ECS tooling/placement systems and related UI/feedback systems in the game.


Fields

  • public Game.Tools.ErrorType m_Error
    The specific error code describing the validation result for the tool/placement. ErrorType is defined in Game.Tools and typically includes values such as None, CannotPlace, Colliding, NotEnoughResources, etc. Default is the default enum value (usually None).

  • public Game.Tools.ToolErrorFlags m_Flags
    Bitfield/flags that modify how the error is treated or presented (for example: show tooltip, block action, high priority). Default is 0 (no flags set).

Properties

  • This type does not declare any C# properties. It only exposes the two public fields above.

Constructors

  • public ToolErrorData()
    No explicit constructors are declared in the source. As a value type (struct) it has the implicit parameterless constructor which initializes fields to their default values. To create an instance with specific values, use an object initializer.

Methods

  • This struct does not declare any methods.

Usage Example

using Unity.Entities;
using Game.Prefabs;
using Game.Tools;

// Create an entity and attach the ToolErrorData component
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = em.CreateEntity(typeof(ToolErrorData));

// Set an error and flags
em.SetComponentData(entity, new ToolErrorData {
    m_Error = ErrorType.CannotPlace,
    m_Flags = ToolErrorFlags.ShowTooltip | ToolErrorFlags.BlockAction
});

{{ Notes - Because ToolErrorData implements IQueryTypeParameter it may be usable directly in certain ECS query APIs that accept query-type parameters (depending on the modding/runtime helpers in use). - ErrorType and ToolErrorFlags are defined in Game.Tools; consult those enums/flags for the exact enumerators and semantics. }}