This page has been translated automatically.
Setting Up Development Environment
High-Level Systems
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
Double Precision Coordinates
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
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.

UnigineScript Cache Files

UnigineScript can be pre-compiled into cache file in order to achieve faster initialization and for distributing final builds without revealing full script sources.

Cache File Creation

The cache file for system and editor scripts is generated automatically (or re-generated, if checksum of the source files doesn't match the one stored in the cache) every time you start the engine. To generate the world script cache file, you need to pass the cache file name as the second argument to world_load command as follows:

Source code
Unigine~# world_load world_name cache_name
In the result, the *.cache file is created in the specified directory (or inside the data directory by default, if the path is not specified).
You need to run the world_load command for each world of your project to generate the required cache files.

After the world script cache file is created, you can delete the source code from the build and still load your world by using the world_load command with the cache file name as the second argument.

You cannot use the *.cache file created with the debug version to load the world with the release version of the engine.
Cache files are not compatible between different versions of the engine, so make sure that you are using the same builds of the engine.

Notice that you can cache only the source code written in UnigineScript (your *.cpp files). To protect assets, use the Archiver tool to pack them into ZIP or UNG.

How to Use Cache Files

The engine looks for the world, system and editor cache files inside the data directory first. After that they are looked for according to the cache_name variable, where cache_name is the path to the cache file stored outside the data directory.

System and Editor Cache Files

To override default cache file names for the system and editor scripts, you can use system_cache andeditor_cache console variables. They can be stored in the engine configuration file. For example:

Source code
Unigine~# system_cache my_system_cache
In the example, the default unigine.cache file is overridden with my_system_cache.cache. To check whether the new cache file is used, run the system_cache without arguments:
Source code
Unigine~# system_cache
system script cache name
system_cache = "my_system_cache"

World Cache File

To use the world script cache file, simply pass its name (or the path to the file, if it is stored outside the data directory) to world_load command as the second argument. Theworld_reload console command can receive the cache file name as an argument as well:

Source code
Unigine~# world_reload cache_name
Last update: 2017-07-03
Build: ()