This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
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
创建内容
Content Optimization
Materials
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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

Members


public static void SetEnabled ( bool enable ) #

Enables or disables the C# Component System.

Arguments

  • bool enable - Use true to enable the C# Component System, false - to disable it.

public static int IsEnabled ( ) #

Returns a value indicating whether the C# Component System is enabled.

Return value

true if the C# Component System is enabled; otherwise false.

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 ) #
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 ) #
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 ) #
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 ) #
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 ) #
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 ) #
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.

protected T FindComponentInWorld<T> ( bool enabled_only ) #
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.

protected T[] FindComponentsInWorld<T> ( bool enabled_only ) #
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.

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: 2021-05-26
Build: ()