Entity
namespace Griff.Scenes;
public sealed class EntityA thing in a scene: a name, a Transform, any number of other components, and child entities. Hierarchy changes go through Scene.
Properties
Section titled “Properties”Children
Section titled “Children”public IReadOnlyList<Entity> Children { get; }Components
Section titled “Components”public IReadOnlyList<Component> Components { get; }All components, starting with Transform.
public Guid Id { get; }Stable identity, preserved across saves, renames and moves.
IsActive
Section titled “IsActive”public bool IsActive { get; }True if this entity and all its parents are IsEnabled: the game runs and draws it.
IsEnabled
Section titled “IsEnabled”public bool IsEnabled { get; set; }IsHidden
Section titled “IsHidden”public bool IsHidden { get; set; }Hidden in the editor: the Scene view doesn’t draw it (or anything inside it), so clicks and box selections don’t find it, though the Hierarchy still selects it. The game ignores it and shows it as usual.
IsHiddenInHierarchy
Section titled “IsHiddenInHierarchy”public bool IsHiddenInHierarchy { get; }True if this entity or one of its parents is IsHidden.
IsLocked
Section titled “IsLocked”public bool IsLocked { get; set; }Locked in the editor: clicks and box selections in the Scene view pass through it (and everything inside it) to what’s behind, though the Hierarchy still selects it. The game ignores it.
IsLockedInHierarchy
Section titled “IsLockedInHierarchy”public bool IsLockedInHierarchy { get; }True if this entity or one of its parents is IsLocked.
IsPaused
Section titled “IsPaused”public bool IsPaused { get; }True while the game holds this entity still: it, or something it’s inside, is a paused group (a PauseGroup that’s Paused, or what an open panel or a dialogue being said pauses). Nothing in a paused group moves, animates, runs its scripts or takes input, but it’s still drawn and still solid to what’s outside, and the rest of the game runs on.
public string Name { get; set; }Parent
Section titled “Parent”public Entity? Parent { get; }Prefab
Section titled “Prefab”public string? Prefab { get; set; }The prefab this entity is a placed copy of, as the prefab file’s path in Assets (“Prefabs/Coin.prefab”), or null. Saving the prefab in the editor brings the copy up to date. The game ignores it.
PrefabVersion
Section titled “PrefabVersion”public PrefabVersion? PrefabVersion { get; set; }For a placed copy (Prefab), the version of the prefab it was made from or last brought up to date with: what the copy changed is what differs from it, so the editor keeps those changes when the prefab changes, however it changed. Null for a copy made before copies remembered it. The game ignores it.
public Scene? Scene { get; }Transform
Section titled “Transform”public Transform Transform { get; }Methods
Section titled “Methods”AddChild
Section titled “AddChild”public void AddChild(Entity child)Puts child last inside this entity while neither is in a scene: an entity being built before it goes into one (a template’s, a prefab’s). An entity in a scene moves with Move.
AddComponent
Section titled “AddComponent”public T AddComponent<T>()AddComponent
Section titled “AddComponent”public Component AddComponent(Component component, int? index = default)Attaches component, at index if given (used by undo).
GetComponent
Section titled “GetComponent”public T? GetComponent<T>()GetComponents
Section titled “GetComponents”public IEnumerable<T> GetComponents<T>()IsSelfOrDescendantOf
Section titled “IsSelfOrDescendantOf”public bool IsSelfOrDescendantOf(Entity other)True if this entity is other or one of its descendants.
MoveComponent
Section titled “MoveComponent”public void MoveComponent(Component component, int index)Moves component to index among the components; the Transform stays first.
RemoveChild
Section titled “RemoveChild”public bool RemoveChild(Entity child)Takes child out of this entity while it isn’t in a scene (see AddChild).
Returns whether it was inside this one.
RemoveComponent
Section titled “RemoveComponent”public bool RemoveComponent(Component component)Returns false if the component isn’t attached to this entity.
ReplaceComponent
Section titled “ReplaceComponent”public void ReplaceComponent(Component existing, Component replacement)Swaps existing for replacement at the same position (used by script reload).
SelfAndDescendants
Section titled “SelfAndDescendants”public IEnumerable<Entity> SelfAndDescendants()This entity and all its descendants, depth first.
ToString
Section titled “ToString”public override string ToString()