fix: C# OnLoad method not being run correctly
This commit is contained in:
parent
a6277533e8
commit
275774a10a
@ -261,17 +261,21 @@ namespace hex::script::loader {
|
|||||||
if (!std::fs::exists(scriptPath))
|
if (!std::fs::exists(scriptPath))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_methodExists("Main", scriptPath)) {
|
const bool hasMain = m_methodExists("Main", scriptPath);
|
||||||
|
const bool hasOnLoad = m_methodExists("OnLoad", scriptPath);
|
||||||
|
|
||||||
|
if (hasMain) {
|
||||||
this->addScript(entry.path().stem().string(), false, [this, scriptPath] {
|
this->addScript(entry.path().stem().string(), false, [this, scriptPath] {
|
||||||
hex::unused(m_runMethod("Main", false, scriptPath));
|
hex::unused(m_runMethod("Main", false, scriptPath));
|
||||||
});
|
});
|
||||||
|
} else if (hasOnLoad) {
|
||||||
|
this->addScript(entry.path().stem().string(), true, [] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_methodExists("OnLoad", scriptPath)) {
|
if (hasOnLoad) {
|
||||||
this->addScript(entry.path().stem().string(), true, [this, scriptPath] {
|
|
||||||
hex::unused(m_runMethod("OnLoad", true, scriptPath));
|
hex::unused(m_runMethod("OnLoad", true, scriptPath));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user