Skip to content

Game.UI.InGame.DestroyedTreeSection

Assembly: Assembly-CSharp
Namespace: Game.UI.InGame

Type: class

Base: InfoSectionBase

Summary:
UI info section for destroyed tree entities. This section is intended to be shown when inspecting a destroyed object that is a Tree. It reads the Destroyed component from the selected entity, resolves the PrefabRef of the destroyer to determine which prefab caused the destruction, stores that prefab entity handle, and exposes that information when the UI serializes properties. The section also flags the info UI system with TooltipTags.Destroyed so the appropriate tooltip is shown.


Fields

  • private Unity.Entities.Entity destroyer { get; set; }
    A private auto-property used to store the Entity handle of the prefab that destroyed the tree. It is reset to Entity.Null in Reset() and populated in OnProcess() after resolving the PrefabRef from the Destroyed component.

Properties

  • protected override string group { get; }
    Returns the group identifier "DestroyedTreeSection". Used by the UI framework to categorize/identify this info section.

  • protected override bool displayForDestroyedObjects { get; }
    Always true. Indicates that this section should be considered when displaying information for destroyed objects.

Constructors

  • public DestroyedTreeSection()
    A parameterless constructor marked with [Preserve] in the source. No custom initialization logic in the constructor; initialization/reset logic is handled in Reset().

Methods

  • protected override void Reset() : System.Void
    Resets internal state for reuse. Currently sets destroyer to Entity.Null to clear any previously stored destroyer reference.

  • private bool Visible() : System.Boolean
    Determines visibility of the section. Returns true when the inspected object is destroyed (base.Destroyed) and the selected entity has a Tree component (base.EntityManager.HasComponent(selectedEntity)). Used by OnUpdate() to set the section visible state.

  • [Preserve] protected override void OnUpdate() : System.Void
    Called during update; sets base.visible = Visible() so the UI framework shows or hides this section based on the current selection and destroyed state.

  • protected override void OnProcess() : System.Void
    Reads the Destroyed component from the selected entity, attempts to get the PrefabRef component for the Destroyed.m_Event, and if successful stores the referenced prefab Entity in destroyer. Also adds TooltipTags.Destroyed to the info UI system's tooltipTags collection so the destroyed tooltip is displayed.

  • public override void OnWriteProperties(IJsonWriter writer) : System.Void
    Serializes the "destroyer" property to JSON. If destroyer is not Entity.Null it resolves the corresponding PrefabBase via m_PrefabSystem and writes the prefab.name; otherwise it writes a JSON null. This is used when the UI serializes section properties for external tools or logs.

Usage Example

[Preserve]
public override void OnWriteProperties(IJsonWriter writer)
{
    writer.PropertyName("destroyer");
    if (destroyer != Entity.Null)
    {
        PrefabBase prefab = m_PrefabSystem.GetPrefab<PrefabBase>(destroyer);
        writer.Write(prefab.name);
    }
    else
    {
        writer.WriteNull();
    }
}