Optional dynamically loaded modules

I have a couple of (probably naive) questions about dynamic loading of modules if anyone know about this stuff. I have various plugins and utility modules that have dependencies on each other (some hard some weak) and I’d like to be able to just drop subsets of them into a project and not have it blow up because not everything is there. So…

  1. Is there some way of using DynamicallyLoadedModuleNames to specify a weak dependency on a module that may not even exist in the project at build time? Or put another way, can I somehow detect if module Y is present in the project/engine from within module X’s build script, and conditionally only add Y to DynamicallyLoadedModuleNames if it is?

  2. Is there some way to try to load a module but gracefully fail if it can’t be loaded? Specifically, say I want to try to load module X, which may have been built with a static dependency on module Y. If X is present at runtime but Y is not, then using LoadModuleWithFailureReason to load X generates a nasty OS dialog (on Windows). Is this just something that I shouldn’t even be trying to do?

1 Like