Merge pull request #441 from SHADE-DP/SP3-6-c-scripting

Fixed issues where scripts cannot be loaded if another instance of the engine is using it
This commit is contained in:
XiaoQiDigipen 2023-03-25 15:52:51 +08:00 committed by GitHub
commit a40c59872c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -116,8 +116,9 @@ namespace SHADE
try try
{ {
oss << "[EngineInterface] Loading " << Convert::ToNative(ManagedLibraryName) << ".dll"; oss << "[EngineInterface] Loading " << Convert::ToNative(ManagedLibraryName) << ".dll";
managedLibFile = File::Open(managedLibPath, FileMode::Open, FileAccess::Read); managedLibFile = File::Open(managedLibPath, FileMode::Open, FileAccess::Read, FileShare::Read);
scriptContext->LoadFromStream(managedLibFile); scriptContext->LoadFromStream(managedLibFile);
managedLibFile->Close();
oss.str(""); oss.str("");
oss << "[EngineInterface] Successfully loaded " << Convert::ToNative(ManagedLibraryName) << ".dll"; oss << "[EngineInterface] Successfully loaded " << Convert::ToNative(ManagedLibraryName) << ".dll";
Debug::Log(oss.str()); Debug::Log(oss.str());