Jump to content

[SOLVED] Loading script cache without source


photo

Recommended Posts

In previous versions of Unigine (I believe it still worked in 2.9) it was possible to delete the script source code after making a build by adding an additional parameter to the world_load command. In Unigine 2.11 and 2.12 this does not seem to work anymore though, even though the documentation still mentions this trick: https://developer.unigine.com/en/docs/2.12/code/uniginescript/cache

It still loads the world itself, but does not load and execute the script anymore, instead you get a "FileSystem::addVirtualFile(): can't find mount point" error.  Is there a way to fix this? We do need to keep our script source out of the final builds as otherwise clients might be able to bypass some license checks that haven't been moved to C++ yet.

 

Simple repro steps would be to create a fresh Unigine 2.12 script-only project in the SDK browser, add a "log.message("Hello world") to the init function and make a build. Then run the build, open the console and call the world_load command to generate the cache. Finally delete the .usc file from the build and start the build again and try to load the cache using the world_load command and instead of "Hello world" there is an error.

Edited by Bemined
Added repro
Link to comment

Could you please check if modifying source/engine/world/World.cpp will work in your case? Both changes are in the same function World::do_load_world(const char *p, const char *cache):

// Patch 1 [int World::do_load_world(const char *p, const char *cache)]
if (cache_name.size() && engine.filesystem->isFileExist(cache_name) == 0)

// After:
if (cache_name.size() && (engine.filesystem->isFileExist(cache_name) == 0))
  
// Patch 2 [int World::do_load_world(const char *p, const char *cache)]
if (script_path.isValid())
  
// After:
if (script_path.isValid() || cache_name.size())

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • silent changed the title to [SOLVED] Loading script cache without source
×
×
  • Create New...