Table of Contents

Class InternalComponentHub

Namespace
Cobilas.GodotEngine.Component
Assembly
com.cobilas.godot.icomponent.dll

Inner class for handling IComponentHub.

[Serializable]
public sealed class InternalComponentHub : IInternalComponentHub, IComponentHub, IEnumerable<Node>, IEnumerable, IDisposable
Inheritance
InternalComponentHub
Implements
Inherited Members

Constructors

InternalComponentHub(Node)

Inner class for handling IComponentHub.

public InternalComponentHub(Node entity)

Parameters

entity Node

Properties

ComponentsCount

The number of child objects.

public int ComponentsCount { get; }

Property Value

int

Returns the number of child objects.

Entity

The Godot.Node object that is associated.

public Node? Entity { get; }

Property Value

Node

Returns the associated Godot.Node object.

Parent

The parent object.

public Node? Parent { get; }

Property Value

Node

Returns the parent object.

ParentComponent

The parent object as IComponentHub.

public IComponentHub? ParentComponent { get; }

Property Value

IComponentHub

Returns the parent object as IComponentHub.

Methods

AddComponent(Type?)

Allows you to add a component by specifying its type.

public Node? AddComponent(Type? component)

Parameters

component Type

The type to be added.

Returns

Node

Returns the type that was added.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

AddComponent<TypeComponent>()

Allows you to add a component by specifying its type.

public TypeComponent? AddComponent<TypeComponent>() where TypeComponent : Node

Returns

TypeComponent

Returns the type that was added.

Type Parameters

TypeComponent

The type to be added.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

AddComponents(params Type[]?)

Allows you to add multiple components by specifying their type.

public void AddComponents(params Type[]? components)

Parameters

components Type[]

The types to be added.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

AddNodeComponent(Node?)

Allows you to add a Godot.Node object to the component list.

public void AddNodeComponent(Node? component)

Parameters

component Node

The Godot.Node object to add.

AddNodeComponents(params Node[]?)

Allows you to add multiple Godot.Node objects to the component list.

public void AddNodeComponents(params Node[]? components)

Parameters

components Node[]

The Godot.Node objects to add.

AddRequireComponent(Node?)

Static function to add components automatically.

public static void AddRequireComponent(Node? mono)

Parameters

mono Node

Target Godot.Node object.

Remarks

The target Godot.Node object must have the RequireComponentAttribute attribute to specify the types to be added.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~InternalComponentHub()

The destructor is responsible for discarding unmanaged resources.

protected ~InternalComponentHub()

GetComponent(Type?)

Gets the component by the specified type.

public Node? GetComponent(Type? component)

Parameters

component Type

The type to be obtained.

Returns

Node

Returns the component type as node.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponent(Type?, bool)

Gets the component by the specified type.

public Node? GetComponent(Type? component, bool recursive)

Parameters

component Type

The type to be obtained.

recursive bool

Allows searching in sub-children.

Returns

Node

Returns the component type as node.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponent<TypeComponent>()

Gets the component by the specified type.

public TypeComponent? GetComponent<TypeComponent>() where TypeComponent : Node

Returns

TypeComponent

Returns the component type as node.

Type Parameters

TypeComponent

The type to be obtained.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponent<TypeComponent>(bool)

Gets the component by the specified type.

public TypeComponent? GetComponent<TypeComponent>(bool recursive) where TypeComponent : Node

Parameters

recursive bool

Allows searching in sub-children.

Returns

TypeComponent

Returns the component type as node.

Type Parameters

TypeComponent

The type to be obtained.

Remarks

If the specified type is null or not found in the component list, an object of type NullNode will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponents(Type?)

Gets components by the specified type.

public Node[]? GetComponents(Type? component)

Parameters

component Type

The type to be obtained.

Returns

Node[]

Returns the component types as a node list.

Remarks

If the specified type is null or not found in the component list, an empty list will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponents(Type?, bool)

Gets components by the specified type.

public Node[]? GetComponents(Type? component, bool recursive)

Parameters

component Type

The type to be obtained.

recursive bool

Allows searching in sub-children.

Returns

Node[]

Returns the component types as a node list.

Remarks

If the specified type is null or not found in the component list, an empty list will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponents<TypeComponent>()

Gets components by the specified type.

public TypeComponent[]? GetComponents<TypeComponent>() where TypeComponent : Node

Returns

TypeComponent[]

Returns the component types as a node list.

Type Parameters

TypeComponent

The type to be obtained.

Remarks

If the specified type is null or not found in the component list, an empty list will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetComponents<TypeComponent>(bool)

Gets components by the specified type.

public TypeComponent[]? GetComponents<TypeComponent>(bool recursive) where TypeComponent : Node

Parameters

recursive bool

Allows searching in sub-children.

Returns

TypeComponent[]

Returns the component types as a node list.

Type Parameters

TypeComponent

The type to be obtained.

Remarks

If the specified type is null or not found in the component list, an empty list will be returned.

Exceptions

ArgumentException

Occurs when the specified type does not inherit from Godot.Node.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<Node> GetEnumerator()

Returns

IEnumerator<Node>

An enumerator that can be used to iterate through the collection.

RemoveComponent(Node?)

Allows you to remove a Godot.Node object from the list of components.

public bool RemoveComponent(Node? component)

Parameters

component Node

The Godot.Node object to remove.

Returns

bool

Returns true if the operation is successful.

RemoveComponents(params Node[]?)

Allows you to remove several Godot.Node objects from the list of components.

public void RemoveComponents(params Node[]? components)

Parameters

components Node[]

The Godot.Node objects to be removed.