This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
VR Development
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Сэмплы материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

ComponentSystem Class

This class implements functionality of the C# Component System and is used to create, destroy, and manage components.

Notice
This class is a singleton.

See Also#

  • C# Sample: source/samples/Api/Logics/ComponentSystem

ComponentSystem Class

Properties

bool Enabled#

The Value indicating whether the C# Component System is enabled: true if the C# Component System is enabled; otherwise false.

Members


public static void SaveProperties ( ) #

Creates property files for all components. Parameters of each component are stored in a separate *.prop file. If these property files do not exist, they will be created in the data/.runtimes folder.

public static void SaveProperties ( out List <string> created_files, out List <string> modified_files, out List <string> broken_files ) #

Creates property files for all components and returns lists of created, modified, and broken files. Parameters of each component are stored in a separate *.prop file. If these property files do not exist, they will be created in the data/.runtimes folder.

Arguments

  • out List <string> created_files - Buffer list to which paths to all created *.prop files will be placed.
  • out List <string> modified_files - Buffer list to which paths to all modified *.prop files will be placed.
  • out List <string> broken_files - Buffer list to which paths to all broken *.prop files will be placed.

public static T AddComponent<T> ( Node node ) #
where T : Component

Adds the component to the specified node.

Arguments

  • Node node - Node, to which the component is to be added.

Return value

New added component instance, if it was successfully added to the specified node; otherwise null.

public static T GetComponent<T> ( Node node, bool enabled_only = false ) #
where T : Class

Returns the first component of the specified type associated with the specified node.

Arguments

  • Node node - Node, for which the component of this type is to be found.
  • bool enabled_only - Enabled flag: true to get enabled component only, false to get component in any case.

Return value

Component if it exists; otherwise, null.

public static T[] GetComponents<T> ( Node node, bool enabled_only = false ) #
where T : Class

Returns all components of this type assigned to the specified node.

Arguments

  • Node node - Node, whose components are to be retrieved.
  • bool enabled_only - Enabled flag: true to get only enabled components, false to get all components.

Return value

Array containing all found components of this type (if any); otherwise null.

public static T GetComponentInChildren<T> ( Node node, bool enabled_only = false ) #
where T : Class

Returns the first component of this type found among all the children of the specified node (including the node itself). This method searches for the component in the following order:
  • node itself
  • node reference
  • node's children
  • children of node's children

Arguments

  • Node node - Node, whose hierarchy is to be checked for the components of this type.
  • bool enabled_only - Enabled flag: true to get enabled component only, false to get component in any case.

Return value

Component if it exists; otherwise, null.

public static T[] GetComponentsInChildren<T> ( Node node, bool enabled_only = false ) #
where T : Class

Searches for all components of this type down the hierarchy of the specified node.

Arguments

  • Node node - Node, whose hierarchy is to be checked for the components of this type.
  • bool enabled_only - Enabled flag: true to get only enabled components, false to get all components.

Return value

Array containing all found components of this type (if any); otherwise null.

public static T GetComponentInParent<T> ( Node node, bool enabled_only = false ) #
where T : Class

Returns the first component of this type found among all predecessors and posessors of the specified node.

Arguments

  • Node node - Node, whose hierarchy is to be checked for the components of this type.
  • bool enabled_only - Enabled flag: true to get enabled component only, false to get component in any case.

Return value

Component if it exists; otherwise, null.

public static T[] GetComponentsInParent<T> ( Node node, bool enabled_only = false ) #
where T : Class

Searches for all components of this type up the hierarchy of the specified node.

Arguments

  • Node node - Node, whose hierarchy is to be checked for the components of this type.
  • bool enabled_only - Enabled flag: true to get only enabled components, false to get all components.

Return value

Array containing all found components of this type (if any); otherwise null.

public static T FindComponentInWorld<T> ( bool enabled_only = false ) #
where T : Class

Returns the first component of this type found in the current world.

Arguments

  • bool enabled_only - Enabled flag: true to get enabled component only, false to get component in any case.

Return value

Component if it exists; otherwise, null.

public static T[] FindComponentsInWorld<T> ( bool enabled_only = false ) #
where T : Class

Returns the list of all components of this type found in the current world.

Arguments

  • bool enabled_only - Enabled flag: true to get only enabled components, false to get all components.

Return value

Array containing all found components of this type (if any); otherwise null.

public static int RemoveComponent<T> ( Node node ) #
where T : Class

Removes the component from the specified node.

Arguments

  • Node node - Node, from which the component is to be removed.

Return value

1 if the component was successfully removed from the specified node; otherwise 0.

public static int RemoveComponent ( Component component ) #

Removes the specified component.

Arguments

  • Component component - Component to be removed.

Return value

1 if the specified component was successfully removed; otherwise 0.

public static bool CheckComponentMethods ( List<string> error_messages ) #

Checks signatures of all methods in all components. If all methods are correct, true is returned. Otherwise, the specified messages will be printed to the console.

Arguments

  • List<string> error_messages - Error messages to be sent to the console.

Return value

true if all methods are correct.

void GetStatistics ( out int nodes, out int components, out int methods ) #

Returns the current state of the Component System (total number of components, nodes having components assigned, as well as methods for components) putting the values to corresponding variables.

Arguments

  • out int nodes - Total number of nodes with components.
  • out int components - Total number of components.
  • out int methods - Total number of methods in the Component System.
Last update: 19.12.2023
Build: ()