This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
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
CIGI Client Plugin
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.

Unigine.Materials Class

Interface for managing loaded materials via the code. All materials existing in the project are loaded on its start-up and saved on world's saving or on calling the materials_save console command.

See Also#

  • C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/Materials

Materials Class

Properties

bool IsPrecompileAllShaders#

A value indicating if shader precompilation is enabled.
set
Enables or disables shader precompilation.
set value - 1 to enable shader precompilation, 0 - to disable it.

int NumMaterials#

The number of materials loaded for the current project.

Members


bool IsMaterial ( string name ) #

Checks if there is a material with a given name.

Arguments

  • string name - Material name.

Return value

1 if the material exists; otherwise, 0.

bool IsMaterial ( UGUID guid ) #

Checks if there is a material with a given GUID.

Arguments

  • UGUID guid - A material GUID.

Return value

1 if the material exists; otherwise, 0.

Material FindMaterial ( string name ) #

Searches for a material with a given name.

Arguments

  • string name - Material name.

Return value

Material, if found; otherwise, 0.

void ReloadMaterials ( ) #

Reloads all loaded materials.

void DestroyTextures ( ) #

Deletes all textures used by the loaded materials.

bool ReplaceMaterial ( Material material, Material new_material ) #

Replaces the material with the given one.

Arguments

  • Material material - A material to be replaced.
  • Material new_material - A replacing material.

Return value

1 if the material is replaced successfully; otherwise, 0.

Material FindManualMaterial ( string name ) #

Searches for a manual material by the given name.

Arguments

  • string name - A manual material name.

Return value

A manual material instance.

Material FindBaseMaterial ( string name ) #

Searches for a base material by the given name.

Arguments

  • string name - A base material name.

Return value

A base material.

void CompileShaders ( Material[] materials ) #

Compiles shaders for all specified materials.

Arguments

  • Material[] materials - Vector containing the list of materials for which shaders are to be compiled.

void CompileShaders ( ) #

Compiles shaders for all loaded materials.

void CreateShaders ( ) #

Creates all shaders for all loaded materials.

void ReloadShaders ( ) #

Reloads all shaders used by the loaded materials.

void DestroyShaders ( ) #

Deletes all shaders used for the loaded materials.

bool SaveMaterials ( ) #

Saves changes made for all loaded materials.

Return value

1 if materials are saved successfully; otherwise, 0.

Material GetMaterial ( int num ) #

Returns the material by its number.

Arguments

  • int num - Material number.

Return value

A material.

Material FindMaterialByPath ( string path ) #

Searches for a material stored by the specified path.

Arguments

  • string path - A loading path of the material (including a material's name).

Return value

A material instance.

Material LoadMaterial ( string path ) #

Loads a material stored by the given path. The function can be used to load materials created during application execution or stored outside the data directory.

Arguments

  • string path - A path to the material (including its name).

Return value

A loaded material.

Material FindMaterialByGUID ( UGUID guid ) #

Searches for a material with the given GUID.

Arguments

  • UGUID guid - A material GUID.

Return value

A material instance.

bool IsManualMaterial ( string name ) #

Checks if the material with the given name is the manual one.

Arguments

  • string name - A material name.

Return value

1 if the material is the manual one; otherwise, 0.

bool IsBaseMaterial ( string name ) #

Checks if the material with the given name is the base one.

Arguments

  • string name - A material name.

Return value

1 if the material is the base one; otherwise, 0.

string GetMaterialName ( int num ) #

Returns a name of the material with the given number.

Arguments

  • int num - A material number.

Return value

A material name.

bool RemoveMaterial ( UGUID guid, bool remove_file = 0, bool remove_children = 1 ) #

Deletes a material. If the remove_file flag is enabled, the material file will be deleted as well. If the flag is disabled, the deleted material will be loaded again on the next application start-up. If the remove_children flag is enabled, all the children of the material will be deleted as well.

Arguments

  • UGUID guid - GUID of the material to be removed.
  • bool remove_file - Flag indicating if the material file will be deleted.
  • bool remove_children - Flag indicating if all the children of the material will be also deleted.

Return value

1 if the material is deleted successfully; otherwise, 0.

Material FindMaterialByFileGUID ( UGUID guid ) #

Searches for a material with the given GUID of a material file.

Arguments

  • UGUID guid - A GUID of a material file.

Return value

A material instance.
Last update: 2019-08-16
Build: ()