This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

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: 2024-04-19
Build: ()