大家好,我叫人宅
加载自己做的引擎插件报错
![UE4引擎插件制作遇到的问题(一)_第1张图片](http://img.e-com-net.com/image/info8/182c70a0e9c249bb9b18a312b17c9ac5.jpg)
PrimaryGameModuleCouldntBeLoaded", "The game module '{0}' could not be loaded. There may be an operating system error or the module may not be properly set up.
先讲解一下关于加载的简单流程:
在UE4加载引擎的71%-75%区间开始加载我们的插件。也就是引擎预初始化的时候。
int32 EnginePreInit( const TCHAR* CmdLine )
{
int32 ErrorLevel = GEngineLoop.PreInit( CmdLine );
return( ErrorLevel );
}
int32 FEngineLoop::PreInit( const TCHAR* CmdLine )
{
...
if ( !LoadStartupModules() ) // 引擎加载到71%- 75%
{
// At least one startup module failed to load, return 1 to indicate an error
return 1;
}
...
}
//开始加载插件
bool FProjectManager::LoadModulesForProject( const ELoadingPhase::Type LoadingPhase )
{
...
//加载
FModuleDescriptor::LoadModulesForPhase(LoadingPhase, CurrentProject->Modules, ModuleLoadFailures);
...
}
这个时候出现了
![UE4引擎插件制作遇到的问题(一)_第2张图片](http://img.e-com-net.com/image/info8/182c70a0e9c249bb9b18a312b17c9ac5.jpg)
首先要检查是不是加载 了该模块
在.uproject里面 在项目里面
"Plugins": [
{
"Name": "MD_SqlTool",
"Enabled": true
},
如果确定没什么问题
再检查.uplugin 里面
"Type": "Runtime",
"LoadingPhase": "PreDefault"
PreDefault:是在引擎未加载Uobject时候开始加载该插件
一下是引擎源代码
bool FEngineLoop::LoadStartupModules()
{
FScopedSlowTask SlowTask(3);
SlowTask.EnterProgressFrame(1);
// Load any modules that want to be loaded before default modules are loaded up.
if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PreDefault) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PreDefault))
{
return false;
}
SlowTask.EnterProgressFrame(1);
// Load modules that are configured to load in the default phase
if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::Default) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::Default))
{
return false;
}
SlowTask.EnterProgressFrame(1);
// Load any modules that want to be loaded after default modules are loaded up.
if (!IProjectManager::Get().LoadModulesForProject(ELoadingPhase::PostDefault) || !IPluginManager::Get().LoadModulesForEnabledPlugins(ELoadingPhase::PostDefault))
{
return false;
}
return true;
}
如果关于插件制作商有什么问题欢迎留言:
如果对独立游戏感兴趣也可以
http://www.aboutcg.org/course/tut_ue4programming_180119/